How to get the workflow context sys_id in the workflow for run script activity.

nagapramodkanch
Kilo Guru

Hi,

I need to populate the u_context (referenced to wf_context) in the run script activity of the workflow,

but would need a way to get this into the workflow, any inputs?

11 REPLIES 11

I need to populate the u_context (referenced to wf_context) on the custom table record. The are 3-4 workflows that run on the record.(some workflows and some sub flows).



There are can be more than one workflow context per record, depends on the no.of workflows you configure.


In such a case you can use the same script, just change the if to while loop



var id = '';


var gr = new GlideRecord('wf_context');


gr.addQuery("id", current.sys_id);


gr.query()


while(gr.next()){


gr.u_context = gr.sys_id;


gr.update();


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Have you tried the script?



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


This will not serve the purpose, the u_context is the reference field to


hold single record, if the script returns many which one would it store,


(will have to identify the intended record in wf_context to be populated


with gr.addQuery which in my case will have to be hardcoded with sys_id or


name and dont think this would be a good idea), so is the reason am trying


to aceive with BR from the wf_context table.



On Fri, Mar 10, 2017 at 1:49 PM, alikuttyka <


Rishi18
Kilo Expert

Did you solve this? I also need to get the workflow context sys_id in workflow run script activity