The CreatorCon Call for Content is officially open! Get started here.

How do I pass the Sys ID of the current Business Application in a UI Action to a Flow

matthew_hughes
Kilo Sage

I've got a UI action called 'Inherit parent BIA outcomes' on a business application form:

 

matthew_hughes_0-1739462664689.png

 

The code within the UI Action is:

inherit();

function inherit() {
    var busApp = new GlideRecord('cmdb_ci_business_app');
    if (busApp.get(current.sys_id)) {
        busApp.u_record_condition = 'bia_approval';
        busApp.update();

       try {
        var inputs = {};
        inputs['current'] = busApp; // GlideRecord of table:  
        inputs['changed_fields'] = busApp.u_record_condition; // Array.Object
        inputs['table_name'] = 'cmdb_ci_business_app';

        // Start Asynchronously: Uncomment to run in background.
        // sn_fd.FlowAPI.getRunner().flow('global.lbg_bia_refresh_update_inherited_bia_logic').inBackground().withInputs(inputs).run();
               
        // Execute Synchronously: Run in foreground.
        sn_fd.FlowAPI.getRunner().flow('global.copy_of_lbg_bia_refresh_update_inherited_bia_logic').inForeground().withInputs(inputs).run();
       
    } catch (ex) {
        var message = ex.getMessage();
        gs.error(message);
    }
}

action.setRedirectURL(current);
}
 
However, what I'm wanting to do is pass the Sys ID of the current Business Application into my flow in Flow Designer, but I'm not too sure how to do this. I'm wanting to pass the Sys ID into my flow variable called 'child Sys ID' and possibly use it in the trigger:

matthew_hughes_1-1739462877703.png

 

Can anyone guide me on what I need to do pass the Sys ID of the current Business Application into my flow so that the flow runs when the user clicks on the UI Action?

 

9 REPLIES 9

Hi @Ankur Bawiskar  I managed to find a solution by adding the 'updated by' condition in the trigger and that solved my issue so that there isn't a conflict.

@matthew_hughes 

can you share what worked for you so that it helps other members as well?

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

Hi @Ankur Bawiskar This is the extra  condition that I included in my trigger:

matthew_hughes_0-1739530551483.png

 

@matthew_hughes 

Can you check your earlier question? Seems you marked your own response as correct

How to apply a SYS ID from a piece of code within the Look Up record action of flow designer? 

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

@Ankur Bawiskar  I've now updated the correct response