I created a custum action in flow designer for creating record in expenses tables

Aman Mishra
Tera Contributor


Please correct the following errors before save or publish:

Action Output: Record Sys ID: Empty output value cannot be blank on publish.
Action Output: Expense Number: Empty output value cannot be blank on publish.
Action Output: Status Message: Empty output value cannot be blank on publish

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Aman Mishra 

Things to check

1) are you using the input variable with correct names in your script

2) are you assigning the output to correct output variable

outputs.variableName -> variableName is the value present in the name column and not in label

3) are you configuring the correct output variable in your script step and assigning it?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Aman Mishra
Tera Contributor

 

(function execute(inputs, outputs) {
    var expense = new GlideRecord('x_1027663_expenses_create_new'); // Your custom table name
    expense.initialize();

    expense.u_requested_for = inputs.requested_for;
    expense.u_short_description = inputs.short_description;
    expense.u_amount = inputs.amount;
    expense.u_approval = inputs.approval;

    var sysId = expense.insert();

    if (sysId) {
        action.setOutput('record_sys_id', sysId);
        action.setOutput('expense_number', expense.getValue('number'));
        action.setOutput('status_message', "Expense record created successfully.");
    } else {
        action.setOutput('status_message', "Expense creation failed.");
    }
})(inputs, outputs);

in my output mapping section not seeing script return values

Screenshot 2025-04-12 083112.png