How to check the Short Description of the task

Alex Raducu
Tera Contributor

Hi Everyone,

 

My requirement is to show different Variables and them to be editable on different tasks.

For this to be the most precise we are using a new WF and we want to show the variables and to make them editable based on the Short description as all of the tasks have different Short descriptions.

 

can someone help me with how should i call this in the script include?

In the client script I will use If function to check the sd

 

Thank you!

3 REPLIES 3

Nayan  Dhamane
Kilo Sage

Hello @Alex Raducu ,

As you already mentioned you are using the WF so depending on the task you can select variable which you want to show on the task in the task activity of workflow.

 

For making the fields read only on based of short descripton. It is not necesary to use script include.

You cna just write an onload script, add if condition and mention the fields ehich you want to make read only using below code snippet:

 

g_form.setReadOnly('your field name',true); //makes field read only

g_form.setReadOnly('your field name',false); //make field editable

 

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

Hi  @Nayan Dhamane 

If (g_form.getValue('short_description') = "ShortDescriptionText" 

g_form.setReadOnly('field name',true); 

g_form.setReadOnly('field name',false); 

 

else if (g_form.getValue('short_description') = "ShortDescriptionText2"

 

If (g_form.getValue('short_description') = "ShortDescriptionText" 

g_form.setReadOnly('field name',true); 

g_form.setReadOnly('field name',false); 

 

else if and so on...?

 

Should it work like this?

@Alex Raducu,
https://www.servicenow.com/community/developer-forum/best-practice-to-make-fields-read-only/m-p/2491...

 

https://www.servicenow.com/community/developer-forum/client-script-to-make-fields-read-only-based-on...

 

Use the post asnwer as referrence for script.

 

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.