- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:34 PM
Hi All,
I need to set short description, description, Source and Contact type value Onchange of a Category 2.
For Ex: If Category 1 is Customer and Category 2 is subsequent call for registration
Set Short Description, Description to text and Source (u_req_group), Contact Type to choices.
When I use the below code Short description and Description text is populating and it's not updating (clear or delete) when I change the Category 1 and Category 2. The Short description and Description should populate only with the above mentioned Category 1 and Category 2 choices but not with other choices.
Also, The below code I have used to set values of Source (u_req_group) to 'System' and Contact type to 'Customer Portal / Website' If Category 1 is 'Customer Portal' and Category 2 is 'subsequent call for registration' (same as above), when I use the below code the choice is set to 'System' and 'Customer Portal / Website' but with the new choices (new choice of System and Customer Portal is creating in the fields). The choices are already available and the values should set for only the above mentioned Category 1 and Category 2 choices and not with other category 1 and category 2 choices.
I have used Clear Value and Clear option in script but no luck.
Please suggest.
Thank you
if(g_form.getValue('u_sub_category') == 'subsequent call for registration' && g_form.getValue('u_category') == 'customer_portal'){
g_form.setValue('short_description', 'RegReq open');
g_form.setValue('description', 'Kunde hat den Passwortlink noch aktiviert Bitte Prüfen und bearbeiten');
g_form.setValue('u_req_group', 'source_system_w');
g_form.setValue('contact_type', 'portal_w');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:59 PM
@Dileep2 Create Ui policy with following
Filter condition :
'u_sub_category' is 'subsequent call for registration' AND 'u_category' is 'customer_portal'
Then in execute if true write below script:
g_form.setValue('short_description', 'RegReq open');
g_form.setValue('description', 'Kunde hat den Passwortlink noch aktiviert Bitte Prüfen und bearbeiten');
g_form.setValue('u_req_group', 'source_system_w');
g_form.setValue('contact_type', 'portal_w');
In execute if false write below script:
g_form.setValue('short_description', '');
g_form.setValue('description', '');
g_form.setValue('u_req_group', '');
g_form.setValue('contact_type', '');
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:52 PM
Hi @Dileep2,
It creates confusion and not clear to me. Can you explain it clearly without confusion.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:59 PM
@Dileep2 Create Ui policy with following
Filter condition :
'u_sub_category' is 'subsequent call for registration' AND 'u_category' is 'customer_portal'
Then in execute if true write below script:
g_form.setValue('short_description', 'RegReq open');
g_form.setValue('description', 'Kunde hat den Passwortlink noch aktiviert Bitte Prüfen und bearbeiten');
g_form.setValue('u_req_group', 'source_system_w');
g_form.setValue('contact_type', 'portal_w');
In execute if false write below script:
g_form.setValue('short_description', '');
g_form.setValue('description', '');
g_form.setValue('u_req_group', '');
g_form.setValue('contact_type', '');
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023