How to find out if a change record was created using a record producer?

Bharat23
Kilo Guru

Hello All,

How to find out if a change record was created using a record producer? I want to make sure that an existing business rule on the change request table does not fire when the change is created using a particular service calalog item (which is a record producer).

Thank you

1 ACCEPTED SOLUTION

Bharat23
Kilo Guru

Found the answer and want to share it with everyone as its a very useful script.



Solution & the script is available on servicenow guru...check the below URL. I reused the same script but am not saving the record producer (RP) name on the resultant record but just checking it on the fly via a business rule. The beauty is that the RP sys ID is available only during the create action hence I was able to skip the abort action if the record is created using this RP and the record is successfully created. BR still performs the check during update action forces the user to provide the values which are not available via RP else aborts...



//Pull the record producer ID off of the URL map and set it on the task


var map = gs.action.getGlideURI().getMap();


if(map.get('sysparm_action') == 'execute_producer' && map.get('sysparm_id')){


      current.u_record_producer = map.get('sysparm_id');


}



Identify which ServiceNow Record Producer was used to create a record - ServiceNow Guru


View solution in original post

4 REPLIES 4

Bharat23
Kilo Guru

Found the answer and want to share it with everyone as its a very useful script.



Solution & the script is available on servicenow guru...check the below URL. I reused the same script but am not saving the record producer (RP) name on the resultant record but just checking it on the fly via a business rule. The beauty is that the RP sys ID is available only during the create action hence I was able to skip the abort action if the record is created using this RP and the record is successfully created. BR still performs the check during update action forces the user to provide the values which are not available via RP else aborts...



//Pull the record producer ID off of the URL map and set it on the task


var map = gs.action.getGlideURI().getMap();


if(map.get('sysparm_action') == 'execute_producer' && map.get('sysparm_id')){


      current.u_record_producer = map.get('sysparm_id');


}



Identify which ServiceNow Record Producer was used to create a record - ServiceNow Guru


How is it that you have your BR set up Bharat? I have tried to set up the BR on the ServiceNow Guru site and it doesn't appear to be working for me. 

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Bharat,



If you variable editor then you should be able to identify if this came through record producer or not.


Otherwise I think you can create a custom checkbox and mark it to true if the record is created through record producer or not. You can hide this checkbox from the form.


Hersh D
Giga Expert

This table has a mapping of record producers & records generated via them:

sc_item_produced_record 

https://<instance-name>.service-now.com/sc_item_produced_record_list.do