Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to trigger approval from flow

nishantneta
Tera Contributor

Hi,
Im working on triggering approvals for a Catalog Item where I'm selecting Impacting Organizations in a List Collector variable on the basis of which im fetching the contacts and sending approvals to them using Flow Designer, but I'm unable to achieve this.
For this I;ve created a custom action which is fetching the sys_ids of the contacts, and when im using this value from custom action in approvals, im getting below errorScreenshot 2025-11-04 175459.pngScreenshot 2025-11-04 175531.png

 

@Ankur Bawiskar @Dan Bruhn @AbhishekF 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@nishantneta 

As per screenshots it looks approvers are set correctly and no error.

Are those approvers active and not locked out?

Is it getting auto approved?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Ankur Bawiskar logs.png

Can you look at the warning logs, it shows that its parsing error.

Warning    parsing error:

Warning     Skipping approvals due to invalid rule: ApprovesRejectsAnyU[["b88d14843bc02300bfe04d72f3efc4cd","9ead02793b28f610682a7441a3e45a1c","..........

this parsing error is coming up

nishantneta
Tera Contributor

@Ankur Bawiskar all the users are active, and not logged out. and yes the approvals are getting skipped automatically. Also i made sure that the users have 'approver_user' role.

(function execute(inputs, outputs) {
    try {
        var accountIdString = inputs.impact;
        var approverSysIDs = [];
        
        if (!accountIdString) {
            gs.info('Fetch Vendor Approvers: Input string is empty.');
            outputs.approversysids = [];
            return;
        }
        
        gs.info('Fetch Vendor Approvers: Received Account IDs: ' + accountIdString);
        
        var contactGR = new GlideRecord('customer_contact');
        contactGR.addQuery('account', 'IN', accountIdString);
        contactGR.addQuery('active', true);
        contactGR.query();
        
        gs.info('Fetch Vendor Approvers: Found ' + contactGR.getRowCount() + ' active contacts.');
        
        while (contactGR.next()) {
            approverSysIDs.push(contactGR.getUniqueValue().toString());
        }
        
        outputs.approversysids = approverSysIDs;
        
        gs.info('Fetch Vendor Approvers: Final output array of sys_ids: ' + approverSysIDs.join(','));
        
    } catch (e) {
        gs.error('Fetch Vendor Approvers Error: ' + e.message);
        outputs.approversysids = []; 
    }
})(inputs, outputs);

This is the script ive used in my custom action which fetches the sys_ids of the contacts.
For the Output variables and Action Output ive defined the type as : List.User