How to fetch current catalog task state inside catalog client script

Obito
Tera Expert

How to fetch current catalog task state inside catalog client script, so that I can compare if the state is close or not.

Please refer below image.

 

23121.png

2 ACCEPTED SOLUTIONS

Runjay Patel
Giga Sage

Hi @Obito ,

 

You can use code like below.

g_form.getValue('state')

It will give you current task state value.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

In this video i have explained about Web service integration in ServiceNow like how it works, how we can configure it, what are the prerequisite and many more. I have covered below topics in this video. 1. understand Web Service. Like when and how we will use it. 2. Talked about Inbound and ...

@Obito 

if your requirement is to make all variables readonly when task is closed then use this script in normal onLoad client script on sc_task and not catalog client script

function onLoad() {
    if (g_form.getValue('state').toString() == '3')
        g_form.setVariablesReadOnly(true);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

View solution in original post

6 REPLIES 6

Hi @Ankur Bawiskar and @Obito ,

 

It should work, I have tried it in PDI and its working.

See the screenshot for reference.

 

RunjayPatel_0-1734939464727.png

 

RunjayPatel_1-1734939488698.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

In this video i have explained about Web service integration in ServiceNow like how it works, how we can configure it, what are the prerequisite and many more. I have covered below topics in this video. 1. understand Web Service. Like when and how we will use it. 2. Talked about Inbound and ...

Obito
Tera Expert

@Ankur Bawiskar , @Runjay Patel  I tried both. Both are working, Thanks.