How to get WorkFlow context in business rule

Radim4
Tera Contributor

Hello there, I'm trying to figure out, if there is some reliable way of finding the WF Context in BR which has no relation to running WF or RITM.

The scenario:

I have a cat item which takes an xls file, uploads this file into data source, triggers the import into target table. There is a Wait for event action inside WF, this event needs to be triggered from onComplete transform script. Now how do I find the reference to the correct WF Context when I don't know the RITM id inside this onComplete script. 

The reason is that I need to update some WF scratchpad values inside the onComplete script before the WF Wait for event action is triggered. 

Right now I'm storing the RITM ID inside out internal config field, which is not acceptable:

    getWfContext: function() {
		var contextGR = null;
        var wfContextGR = new GlideRecord("wf_context");
        if (wfContextGR.get("id", this.gvsIntmUtils.getConfiguration("qualys_result.load_xls.current_ritm_id"))) {
            contextGR = wfContextGR;
        } 
        return contextGR;
    }

Thank you for any help.

1 ACCEPTED SOLUTION

Hello,

If you are parsing that excel and running transform map through script after submission of catalog item you must be gliding sys_attachment table to get the attachment which is attached to that RITM that gets created after submission and copy that attachment  from RITM to data source which will run the transform map

So if this is the process that you are following , we can glide to sys attachment table again with and get the RITM sys_id which is stored in table_sys_id field and use it in wf_context table

 

Not sure if this works but give it a try 

Please mark my answer correct if it helps you

View solution in original post

9 REPLIES 9

Mohith Devatte
Tera Sage
Tera Sage

Hello,

May i know what is the target table here is it RITM ?

 

Thank you for quick reply. The target table is custom table. 

 

Hello,

If you are parsing that excel and running transform map through script after submission of catalog item you must be gliding sys_attachment table to get the attachment which is attached to that RITM that gets created after submission and copy that attachment  from RITM to data source which will run the transform map

So if this is the process that you are following , we can glide to sys attachment table again with and get the RITM sys_id which is stored in table_sys_id field and use it in wf_context table

 

Not sure if this works but give it a try 

Please mark my answer correct if it helps you

Thats a good idea, thank you for your help, I'll use this solution.