Flow Context UI Action not working in Service Operations Workspace

jlaue
Kilo Sage

Hello - I am trying to get our 'Flow Context' UI Action on the RITM table to work within Service Operations Workspace.  The UI Actions opens the flow designer flow that is executing from the RITM.  The option shows up in the Form Menu, however, once I click on it, nothing happens.  I don't receive an error or anything, nothing happens after clicking.

 

I copied the code from the 'Script' field into the Workspace Client Script field, but that doesn't seem to work from what I am experiencing.  

 

jlaue_0-1736202405238.png

 

function onClick(g_form) {
    var url = new GlideURL('catalog_flow_context.do');
    url.addParam('sysparm_sys_id', g_form.getUniqueValue());
    url.addParam('sysparm_ck', g_form.getValue("sysparm_ck"));
    g_navigation.open(url.getURL(), "_blank");
}
 
Guessing something needs to be modified in the Workspace Client Script field, just not sure what?
 
Thanks!!

 

 

1 ACCEPTED SOLUTION

@jlaue 

this code worked for me

function onClick(g_form) {
    var gr = new GlideRecord("sys_flow_context");
    gr.addQuery("source_record", g_form.getUniqueValue());
    gr.query(checkRecord);
    function checkRecord(gr) {
        if (gr.next()) {
            var url = '/now/workflow-studio/builder?tableName=sys_flow_context&builderId=flow-execution&sysId=' + gr.sys_id;
            open(url);
        }
    }
}

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@jlaue 

but why?

how it will help the agents to know about the flow context?

let them visit native and click the UI action. it will work from there

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

Ankur Bawiskar
Tera Patron
Tera Patron

@jlaue 

if you still require then update as this in workspace client script

Ensure you set both the checkboxes as true

Workspace Form button and Format for Configurable Workspace

I haven't tested this

function onClick(g_form) {
    var url = 'catalog_flow_context.do?sysparm_sys_id=' + g_form.getUniqueValue() + '&sysparm_ck=' + g_form.getValue("sysparm_ck");
    open(url);
}

AnkurBawiskar_0-1736221327168.png

 

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

@jlaue 

if the above script doesn't work then you can query flow context table with the current ritm sysId and get the flow context sysId and open the url

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

@jlaue 

this code worked for me

function onClick(g_form) {
    var gr = new GlideRecord("sys_flow_context");
    gr.addQuery("source_record", g_form.getUniqueValue());
    gr.query(checkRecord);
    function checkRecord(gr) {
        if (gr.next()) {
            var url = '/now/workflow-studio/builder?tableName=sys_flow_context&builderId=flow-execution&sysId=' + gr.sys_id;
            open(url);
        }
    }
}

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