How to call script include in flow action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 02:25 AM
Hello All,
I have script include and flow with custom flow action and they are OOB. But while triggering it facing issue as
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 05:25 AM
changeStartDate: function(inputs,outputs ) {
gs.info('test 1' + inputs + ' ' + outputs );
try {
// pre-process payload
var currentCaseGr = inputs.currentCase;
gs.info('test 2 ' + currentCaseGr);
var payload = JSON.parse(currentCaseGr.payload);
gs.info('test 3 ' + payLoad);
gs.info('test 4' + JSON.stringify(payLoad));
var startDate = payload.what_should_the_new_employee_s_start_date_be;
if (gs.nil(startDate)) {
var payloadStartDateNullErrMsg = this._formatUtil.format(
'Change start date flow: new start date not populated for case: {0}.',
currentCaseGr.getUniqueValue());
throw this._errorUtil.getError(payloadStartDateNullErrMsg);
}
var parentCaseGr = currentCaseGr.parent.getRefRecord();
var parentCaseSysId = parentCaseGr.getUniqueValue();
if (!parentCaseGr.isValidRecord()) {
var parentCaseNotValidErrMsg = this._formatUtil.format(
'Change start date flow: parent case: {0} not valid.', parentCaseSysId);
throw this._errorUtil.getError(parentCaseNotValidErrMsg);
}
this._changeSubjectPersonJobStartDate(parentCaseGr, startDate);
this._changeSubjectPersonProfileStartDate(parentCaseGr, startDate);
this._changeTaskDueDate(parentCaseSysId);
// update the 'Change start date' case to 'Closed complete' state
currentCaseGr.state = 3;
currentCaseGr.update();
this._errorUtil.validateGrForError(currentCaseGr);
} catch (error) {
throw this._errorUtil.handleExceptionMethod('changeStartDate', error);
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 05:08 AM
Looks like something is wrong with script include line number 588.
Could you please share script include code if possible so that everyone can help you further.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Community Rising Star 2022
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 05:26 AM