[Show Workflow] UI Action for scoped application

amadosierra
Kilo Guru

This is a new thread created to properly separate this issue. Solution has been provided by Pradeep Sharma

Does anybody know how to implement the [Show Workflow] UI Action for an application?

I used the method described above and I get the following error:

Workflow undefined, maybe missing global qualifier

The error is caused by the UI Action condition:

!current.isNewRecord() && (new Workflow().hasWorkflow(current))   

I think it has to do with the scope of the application and the fact that Workflow is not accessible from there.

SOLUTION:


Change the UI Action condition to:

!current.isNewRecord() && (new global.Workflow().hasWorkflow(current))   

Change the UI Action script to:

// Show the workflow context in a new window

function showWorkflowContext() {

    var id = g_form.getUniqueValue();

    var url = new GlideURL('context_workflow.do');

    url.addParam('sysparm_stack', 'no');

    url.addParam('sysparm_table', g_form.getTableName());

    url.addParam('sysparm_document', id);

    var w = getTopWindow();

    w.popupOpenFocus(url.getURL(), 'show_workflow_context', 950, 700, '', false, false);

}

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Amado,



Thanks for the update. I am glad I can be helpful


View solution in original post

5 REPLIES 5

snehalmadakatti
Mega Expert

Thanks a lot for posting the solution.

Regards,

Snehal