- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:13 AM
Hi All,
On our change_request form I have added 3 new fields to a tab called Completion and PCR:
u_chase_status - choice list
u_date_chased - date field
u_person_chased - reference to the sys_user table
u_chase_status is a choice list with dropdown including none with the following options:
If anything other than --none-- is selected(i.e. values 1,2 or 3) then I want the u_person_chased to be populated with the person in the requested_by field on our change request form. I need this to display to the operator when they select one of the answers. Once it has been saved they still need to be able to manually select a different user.
I have tried to write a client script, but this is not working:
Any help on where I have gone wrong is greatly appreciated.
Thanks
Sam
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:24 AM
Hi Sam,
You have done a mistake in the script.
1) error while populating the u_person_chase field from requested by. you did not fetch the value of requested_by field instead wrote name of the variable there
2) error while comparing the values
Updated script:
if(chase = '1' || chase == '2' || chase == '3'){
g_form.setValue('u_person_chase', g_form.getValue('requested_by'));
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:24 AM
Hi Sam,
You have done a mistake in the script.
1) error while populating the u_person_chase field from requested by. you did not fetch the value of requested_by field instead wrote name of the variable there
2) error while comparing the values
Updated script:
if(chase = '1' || chase == '2' || chase == '3'){
g_form.setValue('u_person_chase', g_form.getValue('requested_by'));
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:40 AM
Thanks for the above, I knew that I would have made a silly mistake.
All working now
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 06:50 AM
Hi Sam,
Could you also mark the answer as helpful and hit like. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 07:45 AM
No problem,