我试图将两个数组合并到一个对象数组中,并将此对象设置为变量以供进一步使用。使用脚本格式“javascript”和脚本类型“内联脚本”。
下面是我正在尝试的代码。
var A_Group = execution.getVariableTyped("A_Group", true).getValue()
var B_Group = execution.getVariableTyped("B_Group", true).getValue()
var groupList = new Array
for(var i=0; i<A_Group.length;i++){
    for(var j=0;j<B_Group.length;j++){
       groupList.push({ 
        "A_Group"  : A_Group[i],
        "B_Group"  : B_Group[j]
    });
    }
}
execution.setVariable("GroupList", groupList);但是,每当流到达此脚本时,它都会显示此错误。
500内部服务器错误
{
    "type": "RestException",
    "message": "Cannot instantiate process definition Process_11qsgp3:3:0c411f07-4944-11eb-9f3b-5c80b61f42fc: 
    Cannot serialize object in variable 'GroupList': SPIN/DOM-XML-01030 Cannot create context"
}拜托,任何线索都会有帮助。如果不清楚,请发表评论。
谢谢!
发布于 2021-01-12 03:35:06
你看到https://forum.camunda.org/t/error-while-parsing-json-output-spin-dom-xml-01009/7976了吗?您正在发送的数据可能存在问题。
您还可以考虑使用JS方法concat而不是https://www.w3schools.com/jsref/jsref_concat_array.asp。
另外:
脚本任务中通过执行可以访问的所有进程变量都可以在脚本中使用。
https://docs.camunda.org/manual/latest/reference/bpmn20/tasks/script-task/
https://stackoverflow.com/questions/65490452
复制相似问题