How to check the Short Description of the task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:58 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 02:05 AM
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
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 02:10 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 02:14 AM - edited 08-23-2023 02:14 AM
@Alex Raducu,
https://www.servicenow.com/community/developer-forum/best-practice-to-make-fields-read-only/m-p/2491...
Use the post asnwer as referrence for script.
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
