Unable to set Assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 12:35 AM
Hi Team,
We have a record producer in which we need to set Assignment group based on Functional identifier fields. This functional identifier field is a reference field and refer to x_bii_learning_req_functional_identifier_list table and
x_bii_learning_req_assignment_lookup store both functional identifier and Assignment group.
We have created a script include:-
var BIIB_Assignment_lookup = Class.create();
BIIB_Assignment_lookup.prototype = {
initialize: function() {},
getAssignmentGroup: function(functident) {
var assigngrp;
var grp = new GlideRecord("x_bii_learning_req_assignment_lookup");
grp.addQuery("active", true);
grp.addQuery("functional_identifier.full_name", functident);
//grp.addQuery('sys_id', functident);
grp.query();
if (grp.next()) {
assigngrp = grp.group;
gs.log("kunal1"+assigngrp);
}
return assigngrp;
},
type: 'BIIB_Assignment_lookup'
};
x_bii_learning_req_assignment_lookup- this table contains the Assignment group name and functiona identifier values.
and
var assignmentgroup = new x_bii_learning_req.BIIB_Assignment_lookup().getAssignmentGroup(funident);
current.assignment_group = assignmentgroup;
We have call this in Record producer script.
but unable to get assignment group based on functional identifer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 01:10 AM
Hi,
Are you getting the logs which you have added in the Script include function? Put more logs and trace your code, it would be helpful to find where exactly it fails.
Also I would suggest you to make small change to below part:
if (grp.next()) {
assigngrp = grp.group.toString(); // use toString() here to return sys_id or use assigngrp = grp.group.sys_id;
gs.log("kunal1"+assigngrp);
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 01:13 AM - edited 12-30-2022 01:17 AM
Hi Kunal,
You need to find out the records in "x_bii_learning_req_assignment_lookup" table based on functional identifier sysID but in your glide record query you're querying functional_identifier.full_name instead of functional_identfier. Try glide record query like grp.addQuery("functional_identifier", functident);
//Sample script
var assigngrp;
var grp = new GlideRecord("x_bii_learning_req_assignment_lookup");
grp.addQuery("active", true);
grp.addQuery("functional_identifier", functident);
grp.query();