- 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:25 PM
Hi,
1. I have updated your reference qualifier see the below: if you used this code in catalog item that time you will write the "current.variables.field_value" or if you used in the table that time you will write the only "current.field_value"
javascript: new x_scopedapp.getB().getBA(current.field_value);// I removed the sys_idIN
2. Make the client callable checkbox is false in script include.
client callable=false
"It's working fine for me"
Please Hit like, Helpful or Correct depending on the impact of the response if this solves your query!!
Thanks,
PKG
- 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