- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2019 09:00 AM
Hello,
I have a Record Producer that has a couple of custom fields that aren't on the Record that it is creating. Is there a way to get the value of what is in that Record Producer field through a Business Rule?
So if I have a "Test" field that is on the Record Producer but not on the table with a name of "u_test" could I get the value of that field in a Business Rule and push that value into a Short Description field?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2019 11:59 AM
Andrew,
I think I follow this requirement, let us explore this request more through real table names because I think you referenced the wrong table at the end.
You have a Record Producer with a Variable (u_test) the Record Producer generates an Idea Record on Submit. You need to take the Idea Record Variable and write it to an existing Incident Record Field (u_number). I am not sure how you will query the Incident table to target the correct record because I do not follow how the Incident Record will have a reference to the Idea Record through the number field as you stated.
The method could be an after insert BR but this will only pass the Record Producer Record Variable (u_test), on the 'Idea Table' to all Incidents without a value in the Incident.u_number field on the Incident table.
(function executeRule(current, previous /*null when async*/) {
var rec = current.variables.u_test.toString();
var gr = new GlideRecord('incident');
gr.addQuery('u_number','');
gr.query();
while (gr.next) {
gr.u_number = rec;
}
})(current, previous);
Thanks,
Derrick Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2019 11:59 AM
Andrew,
I think I follow this requirement, let us explore this request more through real table names because I think you referenced the wrong table at the end.
You have a Record Producer with a Variable (u_test) the Record Producer generates an Idea Record on Submit. You need to take the Idea Record Variable and write it to an existing Incident Record Field (u_number). I am not sure how you will query the Incident table to target the correct record because I do not follow how the Incident Record will have a reference to the Idea Record through the number field as you stated.
The method could be an after insert BR but this will only pass the Record Producer Record Variable (u_test), on the 'Idea Table' to all Incidents without a value in the Incident.u_number field on the Incident table.
(function executeRule(current, previous /*null when async*/) {
var rec = current.variables.u_test.toString();
var gr = new GlideRecord('incident');
gr.addQuery('u_number','');
gr.query();
while (gr.next) {
gr.u_number = rec;
}
})(current, previous);
Thanks,
Derrick Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2019 12:32 PM
That works! Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2019 12:53 PM
My pleasure 🙂