Record Producer: Related Fields on another table

bburdick
Mega Guru

Here is my situation. I created a Record Producer that creates Change Tasks. This record producer gets spawned from a UI Action that is on the Change Request form. The issue I am having is after I submit the Record Producer and it has created the Change Task, it does not show which Change Request it is a child of.

I have included some screen shots to show what my record producer (which does show which change request the record producer was spawned by) along with the change task after it is submitted, along with the dictionary field of the change_task.parent field I am trying to populate.

7 REPLIES 7

Mark Stanger
Giga Sage

The relationship to the change request should happen in the 'change_request' field. If you change the name (not the label) of your 'Parent change' variable to 'change_request' it should populate automatically.


Thanks for answering, Mark. I modified as you suggested and found out where my real problem is. I am using this UI Action to launch the record producer:





var changeTask = "sysparm_id=5c010a670c9c540064f7e2da9e4c29a7";
var parentChange = "&sysparm_parentChange=" + g_form.getValue('number');
var startDate = "&sysparm_startDate=" + g_form.getValue('start_date');
var endDate = "&sysparm_endDate=" + g_form.getValue('end_date');

window.open( "/com.glideapp.servicecatalog_cat_item_view.do?" + changeTask + parentChange + startDate + endDate);


changeTask is the sys id of the record producer that gets launched
parentChange is the Change Request number that I want to pass to the Record Producer
startDate and endDate is when the Change Request is suppose to be implemented.

For some reason the "value" that is being passed in my parentChange variable, even though it shows up correctly on the form, does not get passed. I manually typed the value in my variable change_request and then it showed up correctly on the Change Task when I submitted the RP.

I am using the parsing code you have on your website to pass the values:
http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/


It looks like your problem is with your UI action then. The 'Parent change' field is a reference field so you need to pass the sys_id of the change record, not the number. If you change your 'parentChange' line to the following I think it will fix the problem.



var parentChange = "&sysparm_parentChange=" + g_form.getUniqueValue();


Yep, that was it!! Thanks, a lot, Mark! You made this little programmer's day.