- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 06:56 AM
Hi,
i m trying to retrieve the assignement group related to the choice selected in the catalog item.
with this script in a task activity :
var a= current.variables.la_reclamation_concerne.getDisplayValue();
//gs.log(a,'aaaa'); ==> good value.
var getag=new GlideRecord('u_sctask_assignment_socle_open'); ==> for every choice, an assignment group is dedicated in this table.
getag.addQuery('sys_id',a);
//gs.info("Field value iss "+getag.u_recl);
getag.query();
if(getag.next())
{
task.assignment_group=getag.u_assignment_group_open;
}
the variable in the catalog item : la_reclamation_concerne : "Lookup select box"
Any Idea why it s not working?
Thank you for your help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 09:45 AM
It works with this : getag.addQuery('u_recl.label', a);
thank you for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 07:01 AM
Hello,
Please remove .getDisplayValue() while you are accessing your variable . This returns the exact name and not sys_id.
In getag.addQuery('sys_id',a) you are trying to compare "a" with sys_id where "a" has the exact name but not sys_id.
OR
Keep the display value and in the add query line , try comparing with string field in the below line as display value gets you string compare it with name by removing sys_id in this line getag.addQuery('sys_id',a) --> getag.addQuery('name',a)
please mark this helpful if it solves the issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 07:10 AM
i tried with this and still not working :
var a= current.variables.la_reclamation_concerne;
gs.log(a,'aaaa');
var getag=new GlideRecord('u_sctask_assignment_socle_open');
getag.addQuery('u_recl',a);
//gs.log(getag,'aa');
gs.info("Field value iss "+getag.u_recl);
getag.query();
if(getag.next())
{
task.assignment_group=getag.u_assignment_group_open.getValue();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 07:53 AM
Hello Nawal,
Here are 2 thigns to check.
1. As per yoru log, you are getting the name. So you shall not compare that with the sys_id. Check under which field, this value "Base de données DB2" exist in your table such as name or any other field and compare that.
2. you need to change this line. Instead of sys_id, use the right field name for comparison.
getag.addQuery('sys_id',a);
Mark the comment as a correct answer and also helpful if this has helped to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 08:12 AM
i tried with this and still not working :
var a= current.variables.la_reclamation_concerne;
gs.log(a,'aaaa');
var getag=new GlideRecord('u_sctask_assignment_socle_open');
getag.addQuery('u_recl',a);
//gs.log(getag,'aa');
gs.info("Field value iss "+getag.u_recl);
getag.query();
if(getag.next())
{
task.assignment_group=getag.u_assignment_group_open.getValue();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 08:38 AM
the table's field : u_recl is a reference field on the Sys_choice table with the default value : javascript:'elementSTARTSWITHla_reclamation_concerne'