@plusscommunities/pluss-maintenance-aws-forms 2.1.19 → 2.1.20
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/integration/archibus/ArchibusStrategy.js +35 -1
- package/package-lock.json +8051 -0
- package/package.json +1 -1
|
@@ -130,10 +130,23 @@ class ArchibusStrategy extends IntegrationStrategy {
|
|
|
130
130
|
TrackedData: {},
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
// Save the Archibus ID as the job number
|
|
133
|
+
// Save the Archibus ID as the job number and add history entry
|
|
134
|
+
const updatedJob = await getRef(values.tableNameMaintenance, "id", request.id);
|
|
135
|
+
if (!updatedJob.history) updatedJob.history = [];
|
|
136
|
+
updatedJob.history.push({
|
|
137
|
+
timestamp: moment.utc().valueOf(),
|
|
138
|
+
action: "ExternalIDSet",
|
|
139
|
+
externalId: response.data.wrId,
|
|
140
|
+
user: {
|
|
141
|
+
displayName: "Archibus Integration",
|
|
142
|
+
id: "system",
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
134
146
|
await editRef(values.tableNameMaintenance, "id", request.id, {
|
|
135
147
|
jobNo: response.data.wrId,
|
|
136
148
|
jobId: response.data.wrId + "",
|
|
149
|
+
history: updatedJob.history,
|
|
137
150
|
});
|
|
138
151
|
|
|
139
152
|
// add images
|
|
@@ -148,6 +161,27 @@ class ArchibusStrategy extends IntegrationStrategy {
|
|
|
148
161
|
return true;
|
|
149
162
|
} catch (e) {
|
|
150
163
|
log("Archibus:CreateRequest", "Error", e, logId);
|
|
164
|
+
|
|
165
|
+
// Add history entry for failed integration
|
|
166
|
+
try {
|
|
167
|
+
const failedJob = await getRef(values.tableNameMaintenance, "id", request.id);
|
|
168
|
+
if (!failedJob.history) failedJob.history = [];
|
|
169
|
+
failedJob.history.push({
|
|
170
|
+
timestamp: moment.utc().valueOf(),
|
|
171
|
+
action: "ExternalIDSetFailed",
|
|
172
|
+
error: e.message || e.toString(),
|
|
173
|
+
user: {
|
|
174
|
+
displayName: "Archibus Integration",
|
|
175
|
+
id: "system",
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
await editRef(values.tableNameMaintenance, "id", request.id, {
|
|
180
|
+
history: failedJob.history,
|
|
181
|
+
});
|
|
182
|
+
} catch (historyError) {
|
|
183
|
+
log("Archibus:CreateRequest", "HistoryError", historyError, logId);
|
|
184
|
+
}
|
|
151
185
|
}
|
|
152
186
|
return false;
|
|
153
187
|
};
|