How to call script include in flow action.

martin63
Tera Contributor

Hello All,

I have script include and flow with custom flow action and they are OOB. But while triggering it facing issue as 

Error: ErrorMethodName: changeStartDate ## Empty JSON string Source: Process Automation.sys_idFlowAction lineNumber: 2 (sys_script_include.sys_id.script; line 588)
 
Below is custom action and in flow it is called and flow is triggered while creating HR case also in this flow action no output is given and in script include fuction (inputs,outputs) these 2 parameter are passed.
 
Thankyou!!
Any solution/assistance...
find_real_file.png
 
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

both flow and script include are in "Human Resources: Lifecycle Events" scope?

are you sure it's the correct way to invoke it? i.e. are you sending correct input to it with correct type

Did you check any other place how it's invoked?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I don't know that's correct or not in that function 

changeStartDate: function(inputs, outputs) {
        gs.info('test 1' + inputs +  ' ' + outputs );
        try {

            var currentCaseGr = inputs.currentCase;
            var payload = JSON.parse(currentCaseGr.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);
        }
    },

I don't know that's correct or not in that function 

Hi,

check any other place how it's getting invoked.

you might have to understand the function and accordingly send the parameters.

regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader