Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the stage of an SCTASK to use in a Catalog Client Script

Joe Taylor
Giga Guru

I'm trying to perform some UI policies based on a stage of a SCTASK in my workflow.

I can't seem to get the stage value in my catalog client script.

 

When I try this, the stg variable comes up blank.

var stg = g_form.getValue.stage;
alert ("Stage is: " + stg);

 

Can this be done?

1 ACCEPTED SOLUTION

@Joe Taylor,

 

Try below script and check 

 

var ritm = g_form.getReference('request_item');

alert(ritm.stage);

 


Mark the response correct and helpful if the answer assisted your question.

View solution in original post

5 REPLIES 5

Rupanjani
Giga Guru

Hi @Joe Taylor,

 

Try g_form.getValue('stage');

 


Mark the response correct and helpful if the answer assisted your question.

No, this doesn't work.

I think it's because the value of "stage" is part of the RITM workflow, not the form, so the g_form method isn't going to return anything.

What are you trying to achieve? Could you please clarify?

@Joe Taylor,

 

Try below script and check 

 

var ritm = g_form.getReference('request_item');

alert(ritm.stage);

 


Mark the response correct and helpful if the answer assisted your question.