Producer Object

raprohaska
Kilo Guru

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?

8 REPLIES 8

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I don't think the record producer sys_id is available from the producer object.



The only thing I can think of as an alternative to hardcoding the sys_id would be to add a string variable and then hide it and populate the sysid with a client script. It'd be easier just to hardcode it, but if you had multiple record producers you could put it all in a variable set and reuse it.


camds
Kilo Expert

Hi Ronald,



There is a parameter in the URL that has the sysid of the record producer called to create the record. Sadly it appears RP.getParameterValue('sysparam_id') isn't available on the record producer to get the value. You could look at some client side scripting to get the value and put it into a field but ultimately that only achieves the solution that Brad Tilton suggested via a hidden string field.



Cheers,


Cameron


raprohaska
Kilo Guru

I used the combo of these answers. On load, there is a script that pulls the sys_id off the query string and places it into the variable. It is all encapsulated into a variable set and the variable is hidden via ui policy.



Its not perfect and I'm not sure why the producer isn't fully exposed in the producer script but this will have to do.



Thanks,


AA


Anurag Tripathi
Mega Patron
Mega Patron

Use property. Put the sys_id of record producer in a property and access it from other places. if and when you have to change it, you will just need a property change and not code change.


-Anurag