@manyos/smileconnect-api 1.57.0 → 1.57.2

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.
package/conf/clients.json CHANGED
@@ -1994,7 +1994,8 @@
1994
1994
  "Class Location",
1995
1995
  "Class Cost",
1996
1996
  "Department",
1997
- "Class Start Date & Time"
1997
+ "Class Start Date & Time",
1998
+ "Name"
1998
1999
  ]
1999
2000
  },
2000
2001
  "custom_CTM:People": {
@@ -2009,9 +2010,7 @@
2009
2010
  "postMapping": []
2010
2011
  },
2011
2012
  "PUT": {
2012
- "preMapping": [
2013
- "slash"
2014
- ],
2013
+ "preMapping": [],
2015
2014
  "postMapping": [],
2016
2015
  "afterExecution": []
2017
2016
  },
@@ -2179,6 +2178,18 @@
2179
2178
  "constants": [],
2180
2179
  "scripts": {}
2181
2180
  },
2181
+ "custom_MYS:CustomFormTest": {
2182
+ "basequery": "1=1",
2183
+ "fields": [
2184
+ "Request ID",
2185
+ "Short Description",
2186
+ "Submitter",
2187
+ "Status",
2188
+ "Submitter"
2189
+ ],
2190
+ "constants": [],
2191
+ "scripts": {}
2192
+ },
2182
2193
  "changeWorklog": {
2183
2194
  "fields": [
2184
2195
  "Description",
@@ -2256,6 +2267,38 @@
2256
2267
  "basequery": "",
2257
2268
  "scripts": {}
2258
2269
  },
2270
+ "custom_AST:ComputerSystem": {
2271
+ "basequery": "1=1",
2272
+ "fields": [
2273
+ "Instance Id",
2274
+ "Reconciliation Identity",
2275
+ "Name",
2276
+ "Short Description",
2277
+ "Asset ID+"
2278
+ ],
2279
+ "constants": [
2280
+ {
2281
+ "name": "Data Set Id",
2282
+ "value": "BMC.ASSET"
2283
+ }
2284
+ ],
2285
+ "scripts": {
2286
+ "GET": {
2287
+ "preMapping": [],
2288
+ "postMapping": []
2289
+ },
2290
+ "PUT": {
2291
+ "preMapping": [],
2292
+ "postMapping": [],
2293
+ "afterExecution": []
2294
+ },
2295
+ "POST": {
2296
+ "preMapping": [],
2297
+ "postMapping": [],
2298
+ "afterExecution": []
2299
+ }
2300
+ }
2301
+ },
2259
2302
  "incident": {
2260
2303
  "fields": [
2261
2304
  "Incident Number",
@@ -2318,10 +2361,10 @@
2318
2361
  "basequery": "1=1",
2319
2362
  "scripts": {
2320
2363
  "GET": {
2321
- "preMapping": [
2364
+ "preMapping": [],
2365
+ "postMapping": [
2322
2366
  "createRecord"
2323
2367
  ],
2324
- "postMapping": [],
2325
2368
  "afterExecution": []
2326
2369
  },
2327
2370
  "POST": {
@@ -19,6 +19,14 @@
19
19
  "Department": "Department"
20
20
  }
21
21
  },
22
+ "customFormTest": {
23
+ "formName": "MYS:CustomFormTest",
24
+ "mapping": {
25
+ "Short Description": "shortDescription",
26
+ "Submitter": "submitter",
27
+ "Status": "status"
28
+ }
29
+ },
22
30
  "Tasks": {
23
31
  "formName": "TMS:Task",
24
32
  "mapping": {
@@ -71,5 +79,16 @@
71
79
  "Class Id": "class",
72
80
  "Class Id2": "class4"
73
81
  }
82
+ },
83
+ "computerSystem": {
84
+ "formName": "AST:ComputerSystem",
85
+ "mapping": {
86
+ "Name": "name",
87
+ "DatasetId": "dataSetId",
88
+ "Asset ID+": "id",
89
+ "Reconciliation Identity": "reconId",
90
+ "Instance Id": "instanceId",
91
+ "Short Description": "shortDescription"
92
+ }
74
93
  }
75
94
  }
@@ -27,6 +27,7 @@ function getRecords(formConfig, clientConfig, includeString, customOptions, glob
27
27
  }
28
28
 
29
29
  async function createRecord(formConfig, clientConfig, data, globalScriptParams) {
30
+ const idField = getIdField(formConfig)
30
31
  const allScripts = clientConfig[formConfig.configName].scripts;
31
32
  let scripts
32
33
  if (allScripts) {
@@ -55,15 +56,27 @@ async function createRecord(formConfig, clientConfig, data, globalScriptParams)
55
56
  const result = await arquery.createEntry(formConfig.formName, data, clientConfig.options)
56
57
 
57
58
  log.debug('RecordCreateResult', result.data);
58
- const recordCreateId = Object.values(result)[0];
59
+ let recordCreateId = Object.values(result)[0];
59
60
  //Find change id
60
- const resultInterfaceCreate = await arquery.executeARQuery(formConfig.formName, null, "'1'=\"" + recordCreateId + "\"", formConfig.ticketIdField, clientConfig.options)
61
+ if (!recordCreateId) {
62
+ recordCreateId = data[idField]
63
+ }
64
+ if (!recordCreateId) {
65
+ throw ({message: `Id of new record could not be determined. Please provide ${idField} for join forms.`})
66
+ }
67
+
68
+ log.error(idField)
69
+ log.error(recordCreateId)
70
+
71
+ //const query = `'${idField}'=\"${recordCreateId}\"`;
72
+
73
+ /*const resultInterfaceCreate = await arquery.executeARQuery(formConfig.formName, null, query, formConfig.ticketIdField, clientConfig.options)
61
74
  if (resultInterfaceCreate.data && Array.isArray(resultInterfaceCreate.data) && resultInterfaceCreate.data.length > 0) {
62
75
  const recordCreateId = resultInterfaceCreate.data[0][formConfig.ticketIdField];
63
76
  } else {
64
77
  log.error('Cannot create Record', resultInterfaceCreate);
65
78
  throw({message: 'Cannot create Record', details : resultInterfaceCreate});
66
- }
79
+ }*/
67
80
  globalScriptParams.id = recordCreateId
68
81
  //run afterExecution
69
82
  if (scripts && scripts.afterExecution) {
@@ -44,7 +44,7 @@ async function createTicket(ticketConfig, clientConfig, data, globalScriptParams
44
44
 
45
45
  const result = await arquery.createEntry(ticketConfig.forms.new, data, clientConfig.options)
46
46
 
47
- log.debug('TicketCreateResult', result.data);
47
+ log.debug('TicketCreateResult', result);
48
48
  const ticketCreateId = Object.values(result)[0];
49
49
  //Find change id
50
50
  const resultInterfaceCreate = await arquery.executeARQuery(ticketConfig.forms.new, null, "'1'=\"" + ticketCreateId + "\"", ticketConfig.ticketIdField, clientConfig.options)
package/docs/releases.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## API
4
4
 
5
+ ### 1.57.2 - 28.03.22
6
+ Fix problem with custom ids on custom forms
7
+
8
+ ### 1.57.1 - 25.03.22
9
+ Remove misleading error from CustomFormMappings
10
+
5
11
  ### 1.57.0 - 25.03.22
6
12
 
7
13
  Add impersonate to update requests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.57.0",
3
+ "version": "1.57.2",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -153,7 +153,7 @@ function applyCustomFormMapping2Remedy(entryData, mapping, constants, fields) {
153
153
  delete entryData[mappedName];
154
154
  }
155
155
  } catch (e) {
156
- log.error('mappingError', e)
156
+ //log.error('mappingError', e)
157
157
  }
158
158
  })
159
159