How to Call a field userid value from current table to Glided table EncodeQuery ?

sharadha Kuppa2
Tera Expert

Hi All, 

My requirement is  in CMS table Mapping  when i am doing field mappings ..so ,writing  a script for getting a field  value from Impact table to do field mapping with Knowledge table(to populate the  'Opened_by'(userfield)  User first group(from the group list of Opened_by User) in Knowledge group field after doing a click on "Create Knowledge Error" button ) .

 

"Create Knowledge Error" (Button) functionality :
When we click on this button in Impact Form , it will redirect to Create Form of Knowledge article .

 

Need :

After clicking button , Knowledge article form should have auto-populated values form impact table.

 

Issue :
In below code ..when i am calling 'opened_by' getUserID() value in encodedQuery() , code is not working ..Could you help me here what i needs to correct here .

[Note:below script writing on 'u_impact' Table]

(function(source))

{

var oc = gs.getUserID('current.parent.opened_by');

var grUser = new GlideRecord('sys_user_grmember');

grUser.addEncodedQuery('active.group=true^user='+source.oc);

grUser.setLimit(1);

grUser.query();

var count = grUser.getRowCount();

grUser.next();

if(count==1)

return grUser.getValue('group');

else{

return '' ;

}

}

)

 

 

 

I suspect there is an error in syntax in line no :5 (when i tried in backgroud script it's not getting value from opened_by field )

1 REPLY 1

emir
ServiceNow Employee
ServiceNow Employee

answered in your other post