HI,
I am trying to set businesskey in start event form. Below is javascript to set business key.
keyvalue setting as : BK_undefined.
var keyValue;
camForm.on(‘submit’, function(evt) {
var form = $scope.variablesForm;
var variableManager = camForm.variableManager;
inject([ ‘$rootScope’, function($rootScope) {
var xmlhttp = new XMLHttpRequest();
var url = “http://loccahost:8080/seqno?SeqNo=”;
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var value= JSON.parse(this.responseText);
keyValue=value;
}
};
xmlhttp.open(“GET”, url, true);
xmlhttp.send();
camForm.businessKey = ‘BK_’+keyValue;
}]);
});
Appriciate your help.
regards,
k
What is your error message?
Hi Stephen,
Thanks for reply.
The keyValue is coming as undefined.
The businesskey updating as BK_undefined.
The api is returning one sequence number. That number I am able to see in console log.
And it has to be update like BK_123.
Thanks Stephen.Work only when process creation in the BPM only.
when I have fired from rest api, the businesskey coming as null.
http://localhost:8080/engine-rest/process-definition/key/myprocess/start
{
“links”: [ {
“method”: “GET”,
“href”: “http://localhost:8080/engine-rest/process-instance/f09c1979-47b3-11e8-83a8-54ee75123c48”,
“rel”: “self”
}],
“id”: “f09c1979-47b3-11e8-83a8-54ee75123c48”,
“definitionId”: “myprocess:6:ec170688-47b3-11e8-83a8-54ee75123c48”,
“businessKey”: null,
“caseInstanceId”: null,
“ended”: false,
“suspended”: false,
“tenantId”: null
}
*Script below: For Business key **
/
var keyValue;
camForm.on(‘form-loaded’, function()
{
inject([ '$rootScope', function($rootScope)
{
var xmlhttp = new XMLHttpRequest();
var url = "http://localhost:9091/bugseqno?bugSeqNo=";
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var myArr = JSON.parse(this.responseText);
keyValue=myArr;
}
};
xmlhttp.open("GET", url, true);
xmlhttp.send();
}]);
});
camForm.on('submit', function(evt)
{
camForm.businessKey = 'BK_'+keyValue;
});
</script>*/