Producer Object

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2014 09:01 AM
I want to associate data in a user defined table to my record producers and then access that data, via the record producer sys_id, from the record producer script. Is there a way to access the record producer's sys_id from that script so I don't have to hard code it?
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2021 01:45 AM
Hi, Please try this code in record producer script.
Please try var ga= new GlideRecord('user_defined_table');
ga.addQuery('sys_id', producer.reference_fiieldname.sys_id); //reference field is the field from user-defined table mapped or created in the record producer.
mark helpful if it fixes the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 08:14 PM - edited ‎09-26-2024 03:38 PM
I believe you should be able to return the record producer sys_id, using Render Properties, with the following code in the record producer's script field:
RP.getParameterValue('sysparm_id')
This technique is described in the ServiceNow docs - Populate record producer data and redirect users.
Let me know if this worked for you.
Brent
P.S. Please mark this as helpful and/or correct if it resolved your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 10:21 AM
Thanks Brent!
This worked for my use case where we have a field on incidents that logs which record producer it was created from—using render properties gave the desired outcome without having to copy and paste the sys_id for each newly created record producer.
A simple, but effective solution!
current.u_record_producer = RP.getParameterValue('sysparm_id');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2024 03:35 PM
Hey @Tristan Elmore, render properties is a nice feature that doesn't get mentioned very often. Glad this tip helped you. Brent