- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 06:24 PM
I have a record producer variable 'assign to' which mapping to incident table 'assign to' , I want to make this variable automatically populate 'assign to' variable when user request in service portal, How to do it?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 07:00 AM
Hi,
If my reply above was Helpful, please mark it as such.
In the record producer script (on the record producer settings page), you can simply use something like:
if (producer.assigned_to == '') {
current.assigned_to = 'sys_id_here'; //you can also set a sys_id to a system property and instead use: gs.getProperty('property_name');
}
This will evaluate if the assigned_to field is empty on your record producer and if so, place a value on the resulting record automatically.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 07:08 AM
Hi,
It's not recommended to hard-code sys_id.
So please create a system property to hold the default user sysId and in record producer script check if value is present in variable or not
If it's nil then set the default user
if(producer.assigned_to.nil())
current.setValue('assigned_to', gs.getProperty('property_name'));
else
current.setValue('assigned_to', producer.assigned_to);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader