- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 10:08 PM
I have written a client script to populate the location is REQ form the location is getting populated in form view but the location is not getting populated in List view. How can this be fixed.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 11:34 PM
please use before insert/update business rule on sc_request and don't use client script
BR Order: 10000
BR Condition: current.requested_for != ''
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.location = current.requested_for.location;
})(current, previous);
Also ensure the location field on form is REQ own field and not dot walked field
OR Best Way
If customer only wants to see the Location on REQ then why not show Requested For->Location on form as dot walked field. This way no scripting is required.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 10:44 PM
you should save the form so that location is stored in database.
the form field is a dot walked field or REQ's own location field?
share your screenshots and the script etc
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 10:57 PM
Hi Ankur,
Attaching the snip that i am using to get the location populated in REQ
Thanksfor responding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 11:20 PM
is the form getting saved?
If yes then the location on REQ list should show the correct value
Did you check the XML of that record to know if location got populated?
Also did you ensure no other script is clearing this value when record is getting saved?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 11:24 PM
Hi Ankur
I checked the XML is not saving tht location details not sure why. can you help me with this how can the location be saved in XML?
Attaching the snip for reference.
Regards,
Kashika