Skip to content

Commit c964078

Browse files
#2439: refresh createdDate and modifiedDate after updating scripts
1 parent 6bdfb3b commit c964078

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/metadataTypes/Script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ class Script extends MetadataType {
8383
return super.updateREST(script, '/automation/v1/scripts/' + script.ssjsActivityId);
8484
}
8585

86+
/**
87+
* helper for {@link MetadataType.updateREST} and {@link MetadataType.updateSOAP}
88+
*
89+
* @param {MetadataTypeItem} metadataEntry a single metadata Entry
90+
* @param {object} apiResponse varies depending on the API call
91+
* @returns {Promise.<object>} apiResponse, potentially modified
92+
*/
93+
static async postUpdateTasks(metadataEntry, apiResponse) {
94+
// script update endpoint returns wrong values for createdDate and modifiedDate - need to re-retrieve to get correct values
95+
const ssjsActivityId = apiResponse?.ssjsActivityId;
96+
if (ssjsActivityId) {
97+
apiResponse = await this.client.rest.get('/automation/v1/scripts/' + ssjsActivityId);
98+
}
99+
return apiResponse;
100+
}
101+
86102
/**
87103
* Creates a single Script
88104
*

0 commit comments

Comments
 (0)