- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 01:53 AM
Hi.
I have a Record Producer capturing incident details on the portal. We've just introduced User Locations and this populates a read-only field on the Incident form.
However, when a user submits an incident via the portal, the users location doesn't insert into the read-only field.
I've attached a script that was created when the Record Producer was built (presumably)
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 02:26 AM
I think I've worked it out. I've changed your script to
current.incidentlocationfieldname = producer.caller_id.location;
and it seems to have worked!
Thanks so much for the pointers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 02:06 AM
Hello,
Is is location of the one who is creating incident ? and Is location even a field on Incident RP form or just you want to map based on Creator location ? whatever it is you can use below code to map , you can add this in record producer script.
If location field is present on RP form
current.incidentlocationfieldname = producer.field_name;
If location field is not present but map based on creator/requestor location then use below
current.incidentlocationfieldname = producer.requestor_for.locationk;
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 02:15 AM
Thanks for the reply.
Yes, the location is the one who is creating the incident. The record producer captures their userID on the first variable.
The location field is not on the RP and I just wanted to use the Location stored against the userID.
I tried entering the second script but it did not work. I've attached it for you to check. I've also attached the variables just in case.
I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 02:17 AM
Hi,
if the target field is readonly at dictionary level then you cannot set value into it using script.
the script you attached doesn't have anything related to user location field
Did you check any other script is populating the field? i.e. before/after insert BR on incident table
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 02:26 AM
I think I've worked it out. I've changed your script to
current.incidentlocationfieldname = producer.caller_id.location;
and it seems to have worked!
Thanks so much for the pointers