Not able to trigger the Subflow from UI Action

Anthony78
Kilo Sage

Not able to trigger the subflow from UI Action and getting blow error

error : Error triggering subflow: com.snc.process_flow.exception.ProcessAutomationException: Invalid GlideRecord input format found

 

here is code :

 

var lib = 'UI Action';
var func = 'Start Work test';
var logger = new x_usdml_unifyevent.SystemLogHelper(true);

try {
    logger.info(lib, func, 'ENTERING');

    action.setRedirectURL(current);
    current.state = 400; // Setting to In Progress
    current.update();

    gs.info("Triggering subflow from UI action1: " + current.number);

    try {
        var eventType = new GlideRecord('x_usdml_unifyevent_event_type');
eventType.get(current.final_event_type);
        var inputs = {};
        inputs['event'] = current.number.toString();
        inputs['event_type'] = eventType.getDisplayValue();

        gs.info("Inputs for subflow: " + JSON.stringify(inputs));

        /*var result = sn_fd.FlowAPI.getRunner()
            .subflow('x_usdml_unifyevent.processx_it_change_gxp_subflow')
            .inForeground()
            .withInputs(inputs)
            .run(); */
            var result = sn_fd.FlowAPI.executeSubflow('x_usdml_unifyevent.processx_it_change_gxp_subflow', inputs);

        gs.info("Subflow result: " + JSON.stringify(result));
    } catch (subflowError) {
        gs.error("Error triggering subflow: " + subflowError);
    }
} catch (e) {
    logger.reportException(lib, func, e);
} finally {
    logger.info(lib, func, 'LEAVING');
    logger.writeCumulativeEntries(true);
}
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Anthony78 

seems you are not sending the correct inputs to subflow

Seems mismatch in the input you are passing and the subflow inputs configured

Please check that and it should work fine.

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