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

This script where can i write, should i use in UI Action 

prashantgadgil
Kilo Contributor

thanks a lot ...that worked.


Teena Singh
ServiceNow Employee
ServiceNow Employee

Prashant,
Glad to see that you are using the Community to learn more.


The Customer Experience team is striving to ensure that customer queries posted from the HI Service Portal are answered in timely and accurate fashion.


If you feel your question has been resolved, please mark the appropriate reply in the thread as being the Correct Answer.


This enables other customers to learn from your thread.


Thank you in advance.



Regards,


Teena Singh
Customer Experience: UX Strategy and Customer Insights
teena.singh@servicenow.com


ServiceNow


Screen Shot 2017-01-19 at 8.55.52 AM.png


erikbartholdy
Giga Guru

hi everyone 

I am getting the same message in a different context. 

I have made a new workflow on the sn_customservice_case tabel. There is only one condition - the account is someone. I was "in the Customer service scope" when i made the workflow. 

to be able to se it, I have made an UI action "Show workflow" to this table too. (it was not there OOB) 

The workflow starts and works ok, the UI action works ok - but when the record is saved it shows this Error Message "Workflow undefined, maybe missing global qualifier"

it has nothing to do with the UI action, since the workflow is made when the Case record is saved, The error also shows each time the record loads. 

I guess a "Global" is missing somewhere. Is it a Business Rule or Script Include which is starting the workflow? 

any ideas? 

 

br Erik 

The error is coming from the Condition statement being evaluated. You need to global. in front of Workflow.

 

find_real_file.png

 

It should read 

 

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