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.

Source Record is empty

PAULO CESAR FIL
Tera Contributor

Hello everyone. I trying to execute an flow in script, but when I execute it the source record in sys_flow_context 

become empty, someone can help me to fix this?

 

 Source record is empty.png

1 REPLY 1

JimMarciano
Tera Contributor

Hi Paulo Cesar,

I faced the same issue, this is the script that I created and worked for me:

 

    var inputs = {};
    inputs['request_item'] = current; // GlideRecord of table:
    inputs['table_name'] = 'sc_req_item';
    var contextID = sn_fd.FlowAPI.startFlow('flow_name', inputs);
    current.flow_context = contextID;
    current.update()

    if (contextID) {
        var newFlowContext = new GlideRecord('sys_flow_context');
        newFlowContext.get(current.flow_context);
        newFlowContext.source_table = 'sc_req_item';
        newFlowContext.source_record = item.sys_id;
        newFlowContext.update();
    }

 

 

If you think my answers are useful for you, I would appreciate it if you could mark my answers as helpful. 


Best regards,

Jim