Record Producer: Related Fields on another table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2011 09:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2011 01:45 AM
Hi ,
I have a similar code however my problem is I cant get to populate the record producer form with values from my UI action.The Record producer opens alright but the variable in it are not getting populated ta all.
I have named the variables in the record producer exactly as in the change form from where the UI action is called but no luck.I guess I am missing something minor but dont know what.Ideas please.it will be much appreciated.
var record= "sysparm_id=3f1dd0320a0a0b99000a53f7604a2ef9";
var requestor= "&sysparm_requested_by=" + current.requested_by;
var url = "/com.glideapp.servicecatalog_cat_item_view.do?"+record+requestor;
action.setRedirectURL(url);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2011 05:00 AM
Yours is a bit different. The scenario we've been discussing here was how to populate a change request record from a record producer. That can be accomplished just by matching the variable and field names.
What you're trying to do is set catalog variable values based on the values coming in from a standard form. Matching the names isn't going to get you what you want there. You have to set up a client script to parse those URL parameters you're passing in your UI action and set those variable values. Here's an article that should get you going.
http://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2011 05:22 AM
You are right I figured out that I needed to parse the URL fetch the values and then populate the fields on the record producer.
I found a simpler code below that does the job,however thanks for your quick response.
function onLoad() {
var url = document.location.toString();
var userKey = 'sysparm_requested_by=';
var userPosition = url.indexOf(userKey);
if (userPosition != -1) {
var user = url.substr(userPosition+userKey.length, 32);
g_form.setValue('requested_by',user);
}
}