@manyos/smileconnect-api 1.45.4 → 1.45.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,9 +55,19 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
55
55
  const mapping = config.getMapping('task');
56
56
  //add required data
57
57
 
58
- const allTaskFinal = [];
59
- allTask.forEach(thisTask => {
60
- thisTask.TaskName = thisTask.summary;
58
+ let allTaskFinal = allTask;
59
+
60
+ fields.push('TaskName', 'RootRequestInstanceId', 'TaskType', 'Status', 'RootRequestFormName', 'RootRequestMode', 'RootRequestName', 'sequence')
61
+
62
+ //run preScripts
63
+ if (scripts && scripts.preMapping) {
64
+ await scriptController.runScripts(scripts.preMapping, allTaskFinal, clientConfig.clientId, globalScriptParams);
65
+ }
66
+
67
+ allTaskFinal = mappingUtil.applyMapping2Remedy(allTaskFinal, mapping, clientConfig.task.constants, fields);
68
+
69
+ allTaskFinal.forEach(thisTask => {
70
+ thisTask.TaskName = thisTask.Summary;
61
71
  thisTask.TaskType = 2000;
62
72
  thisTask.Status = 1000;
63
73
  thisTask.RootRequestFormName = rootForm;
@@ -65,30 +75,20 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
65
75
  thisTask.RootRequestName = rootRequestId;
66
76
  thisTask.RootRequestInstanceId = rootRequest.data[0]['InstanceId'];
67
77
  thisTask.sequence = thisTask.sequence || "1";
68
- allTaskFinal.push(thisTask);
69
78
  });
70
79
 
71
- fields.push('TaskName', 'RootRequestInstanceId', 'TaskType', 'Status', 'RootRequestFormName', 'RootRequestMode', 'RootRequestName', 'sequence')
72
-
73
- //run preScripts
74
- if (scripts && scripts.preMapping) {
75
- await scriptController.runScripts(scripts.preMapping, taskData, clientConfig.clientId, globalScriptParams);
76
- }
77
-
78
- taskData = mappingUtil.applyMapping2Remedy(taskData, mapping, clientConfig.task.constants, fields);
79
-
80
80
  //run postScripts
81
81
  if (scripts && scripts.postMapping) {
82
- await scriptController.runScripts(scripts.postMapping, taskData, clientConfig.clientId, globalScriptParams);
82
+ await scriptController.runScripts(scripts.postMapping, allTaskFinal, clientConfig.clientId, globalScriptParams);
83
83
  }
84
84
 
85
- const taskResult = await arquery.createEntry('TMS:Task', taskData, clientConfig.options)
85
+ const taskResult = await arquery.createEntry('TMS:Task', allTaskFinal, clientConfig.options)
86
86
  const taskId = taskResult['0'];
87
87
  globalScriptParams.id2 = taskId;
88
88
 
89
89
  //run afterExecution
90
90
  if (scripts && scripts.afterExecution) {
91
- await scriptController.runScripts(scripts.afterExecution, taskData, clientConfig.clientId, globalScriptParams);
91
+ await scriptController.runScripts(scripts.afterExecution, allTaskFinal, clientConfig.clientId, globalScriptParams);
92
92
  }
93
93
 
94
94
  log.debug('Create Task Result', taskResult);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.45.4",
3
+ "version": "1.45.5",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {