Get RecordProducer Name of current RP in RP Script FIeld
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 06:14 AM
how to Get RecordProducer Name of current RP in RP Script FIeld?
If i use current, this object is related to the created record by the RP
if i use producer, this object is related to the "order" user
What do i have to to if i need the name of the RP? Same Question for Business Rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 07:09 AM
I'm afraid you'd just have to take the sys_id of the record producer that runs the script an do a GlideRecord, e.g.:
var producerID = ''; // the sys_id of this record producer
var thisRP = new GlideRecord('sc_cat_item');
thisRP.get(producerID);
Then you should be able to access any fields of the Record Producer. You can use the same approach in a business rule, i.e. create a GlideRecord class on the catalog item table and get the RP you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:41 PM
That's exactly why I wanted to ask.
I find it strange that in this case you can not access "current".
Even with a gliderecord I would have to hardcode the SYSID

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 07:38 AM
Hi,
You can hardcode the record producer name in the script
current.short_description = 'Your Name of Record Producer'; // you need to hard-code it
If you don't want to hardcode it, then use after insert BR on the target table
var gr = new GlideRecord("sc_item_produced_record"); gr.addQuery("task", current.sys_id); gr.query(); if (gr.next()) { current.short_description = gr.producer.name; current.update(); }