Skip to content

Commit

Permalink
Fixed "targetStep" not applied when creating new records
Browse files Browse the repository at this point in the history
  • Loading branch information
shilob committed Dec 3, 2024
1 parent 6617b58 commit 6856c1f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions typescript/api/services/RecordsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,19 @@ export module Services {

// update the metadata ...
createResponse = await this.updateMeta(brand, oid, record, user, false, false);

if (createResponse && _.isFunction(createResponse.isSuccessful) && createResponse.isSuccessful()) {
sails.log.verbose(`RecordsService - create - before ajaxOk`);

if (targetStep) {
let wfStep = await WorkflowStepsService.get(recordType.name, targetStep).toPromise();
this.setWorkflowStepRelatedMetadata(record, wfStep);
}

} else {
sails.log.error('RecordsService - create - Failed to save record: ' + JSON.stringify(createResponse));
return createResponse;
}
// FIX: targetStep not getting applied when creating new records.
// Moved the target step outside of the datastream attachments update block
if (createResponse && _.isFunction(createResponse.isSuccessful) && createResponse.isSuccessful()) {
sails.log.verbose(`RecordsService - create - before ajaxOk`);

if (targetStep) {
let wfStep = await WorkflowStepsService.get(recordType.name, targetStep).toPromise();
this.setWorkflowStepRelatedMetadata(record, wfStep);
}
} else {
sails.log.error('RecordsService - create - Failed to save record: ' + JSON.stringify(createResponse));
return createResponse;
}

if (triggerPostSaveTriggers) {
Expand Down

0 comments on commit 6856c1f

Please sign in to comment.