- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 09:21 AM
I have a reference field "B" whose list is based on value of the Field A which is another Reference field. I added Advance reference qualifier which calls a script include and passes on Field A value (sys_id), something like this
sys_idINjavascript: new x_scopedapp.getB().getBA(current.a);
script include: client callable , All Application access
var getB = Class.create();
getB.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getBA: function(a){
var valueOfA = a;
var tr= []; // to store sys_ids of the field B
var GR = new GlideRecord('x_scoped_table'); ( Gliding a m2m relationship table between Field A and Field B)
GR.addEncodedQuery('a='+valueOfA);
GR.addQuery('active',true);
GR.query();
while(GR.next()){
tr.push(GR.tr.toString());
}
return tr; // sys ids of field B
},
type: 'getB'
});
But its throwing an error current is not defined. How can i pass a current record field values to a script include ??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2019 12:53 AM
Hi Anusha,
Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 09:28 AM
Hi,
there should not be an issue while using current.a
can you check whether log is coming or not for current.a
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 10:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 08:35 PM
Hi Anusha,
can you share the screenshot of the dictionary where you are calling that?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2019 09:33 PM
Hi Anusha,
Update your ref qualifier as below and script include as below and check once
javascript: new x_scopedapp.getB().getBA(current.a);
script include
var getB = Class.create();
getB.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getBA: function(a){
var valueOfA = a;
var tr= []; // to store sys_ids of the field B
var GR = new GlideRecord('x_scoped_table'); ( Gliding a m2m relationship table between Field A and Field B)
GR.addEncodedQuery('a='+valueOfA);
GR.addQuery('active',true);
GR.query();
while(GR.next()){
tr.push(GR.tr.toString());
}
return 'sys_idIN' + tr; // sys ids of field B
},
type: 'getB'
});
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader