Workflow undefined, maybe missing global qualifier

prashantgadgil
Kilo Contributor

Hello All, I have a workflow called "Sample Workflow" in one custom scoped app. I am trying to start it in a UI action from another custom scoped app.

 

var wf = new Workflow();

var   wfId = wf.getWorkflowFromName("Sample Workflow");

var vars = {};

vars.u_var1 = var1_value;

wf.startFlow(wfId, null, "Sample Workflow", vars);

 

When I click on the UI action, I am getting an error which says "Workflow undefined, maybe missing global qualifier"

Does anyone have any pointers on what is missing? how do I declare global qualifier?

Thanks in Advance

 

Prashant

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Prashant,



Easy fix. Add global. in front of your Workflow instantiation.



var wf = new global.Workflow();


var   wfId = wf.getWorkflowFromName("Sample Workflow");


var vars = {};


vars.u_var1 = var1_value;


wf.startFlow(wfId, null, "Sample Workflow", vars);


View solution in original post

14 REPLIES 14

absolutely correct
so it was UI action that did it

THANK YOU

I will buy you a beer at Knowledge 🙂

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

 

Thank you

i would love to, but in this new community I cannot finde the "Correct response button"??? 

i can mark as Helpfull, but not "Correct" ? 

 

br Erik 

Liz Fassone
ServiceNow Employee
ServiceNow Employee

Hi Erik,

I fixed this by moving the UI Action 'Show Workflow' into the Global Scope. 

Cheers,

Liz 

Ed Morris
Giga Contributor

Thanks Chuck, 

This was very helpful. I am also adding the link below which I found very helpful. 

 

https://community.servicenow.com/community?id=community_question&sys_id=089587eddbd8dbc01dcaf3231f96...

 

find_real_file.png