Pass Caller Location from Record Producer

steveturley
Tera Guru

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!

1 ACCEPTED SOLUTION

steveturley
Tera Guru

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

View solution in original post

5 REPLIES 5

Musab Rasheed
Tera Sage
Tera Sage

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

Please hit like and mark my response as correct if that helps
Regards,
Musab

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

Ankur Bawiskar
Tera Patron
Tera Patron

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

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

steveturley
Tera Guru

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