- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:57 PM
I'm trying to figure out a way to connect the sys_id of a request record to the sys_id of the record producer that created it.
is that possible?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 05:23 PM
In the script field of the record producer you can add code to populate a field with the information you want. For example, say you have a field RC on incident table, where RC is a reference to the record producer table. In the script field in the RC, you can use current. u_rc = 'sys_id' of record producer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 01:46 PM
now as well oddly, if my filter is down to one variable, it works properly.
here's the script:
var ID;
switch (current.template.toString()){
case 'db5f551b4fca6e0089c7029d0210c7d9'://sys_id of Contract template
ID = '3e4c5d974fca6e0089c7029d0210c79d';//sys_id of Contracts record producer
break;
case '7481334c4f3db60089c7029d0210c72d'://sys_id of Cost Accounting template
ID = '3891bb4c4f3db60089c7029d0210c725';//sys_id of Cost Accounting record producer
break;
case 'b7fe73444f7db60089c7029d0210c72a'://sys_id of Business Development template
ID = '400f73444f7db60089c7029d0210c72c';//sys_id of BD PM record producer
break;
}
var url;
url = '/com.glideapp.servicecatalog_cat_item_view.do?sysparm_initial=true&sysparm_id=';//url to build string upon
var gr = new GlideRecord("question_answer");//table to query
gr.addQuery('table_sys_id',current.sys_id);//field to query
gr.query();//execute the query
while (gr.next()){
if (gr.question.name == 'project_type')// filtered to only variable
url = url+ID+'&sysparm_'+gr.question.name+'='+gr.value;
}
gs.addInfoMessage('+++My URL is '+url);//this here for testing purposes
action.setRedirectURL(url);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 01:48 PM