Regarding the Dot Walking of Reference field in Group Members Table(sys_user_grmember)

Ganesh75
Giga Contributor

Hi Folks,I Used to get the first group member from the group member table for the assignment field in the Incident form,For this I wrote both before business rule and the client callable script include Methods to check....in these Scripts while querying I used the Code... zero.addQuery('group',ganesh);  in the business rule and it is working fine.... but when I try to use the same query in the Script Include Its not working and I know the reason for that(we have to use the group.name Actually)...

 

I have double checked it ......

 

What my doubt here is Why the query zero.addQuery('group',ganesh)  is working in Business Rule and  not working in Script Include...?????

 

Here is the Code Just for reference...

(function executeRule(current, previous /*null when async*/) {
var ganesh=previous.assignment_group;
var ans=[];
gs.addInfoMessage('The Assignment Group for this Incident is '+ganesh.getDisplayValue());
var zero=new GlideRecord('sys_user_grmember');
zero.orderBy('user');
zero.addQuery('group',ganesh);
zero.query();
while(zero.next()){
ans.push(zero.user.name.toString());
}
for(var i=0;i<=(ans.length)-1;i++){
gs.addInfoMessage('The Members of this assignment group are: '+ans[i]);
}

Thanks in advance for the one who is trying to help me....

 

 

2 REPLIES 2

Joel Millwood2
Kilo Guru

Hi Kiranddfdf,

It would really depend on what you are doing in your Script Include as you have not listed it here, nor how it is being called and what is being passed into it. Your Client Script that calls your Script Include won't have access to the Current and Previous objects but if it is an OnChange Script, it would have access to the oldValue which you could leverage for this purpose.

 

 

Thank U Joel for responding I got the solution for this....