Null value is getting displayed in reference field

suuriya
Tera Contributor

HI Community,

 

I have a requirement; task needs to be assigned to requested for's hub.

Requester's hub assignment group can be found in the field called Hub on the Location form of the location the requester is assigned to. For example, if the requester's location (mentioned in the Location field of their user profile) is OH-Ohio-Work then the hub assignment group for this location mentioned in the Hub field of this location screen will be the one the above-mentioned task will be sent to.

 

For that i have created a catalog task and in advanced condition written this script

var names = current.variables.common_vars_requested_for;
var loc = names.location;
var hubs = loc.u_hub;
gs.addInfoMessage(hubs);
task.assignment_group = hubs.getDisplayValue();
Task is generated with an empty assignment group...it seems null value is getting displayed, but it is not completely empty...so to check added the info message there it is showing the correct name but in task assignment group it is showing null value 
Please let me know how we can fix this
suuriya_0-1715087672760.png

 

 

Thanks in Advance!

1 ACCEPTED SOLUTION

Oh well if its a group, you need to change cmn_location to sys_user_group

View solution in original post

13 REPLIES 13

Oh well if its a group, you need to change cmn_location to sys_user_group

Community Alums
Not applicable

Hi @suuriya ,

Please check 2 points 

1. Try to place your code like 

task.setValue('assignment_group', hubs);

task.update();

2. Assignment Group is reference field so please check the display true field has the like for example display field is Name so please check if name has some value or not.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Community Alums
Not applicable

@suuriya ,

Check one more thing like you can log what is coming in hubs , assignment_group is reference field so we need sys_id.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

HI @Community Alums ,

Thanks for the reply

I tried by adding task.update() but still it didnt worked and i also use gs.addinfomessage to check the hubs it is displaying the value/name present in hub field of the location form.

 

Requester's hub assignment group can be found in the field called Hub on the Location form of the location the requester is assigned to. For example, if the requester's location (mentioned in the Location field of their user profile) is OH-Ohio-Work then the hub assignment group for this location mentioned in the Hub field of this location screen will be the one the above-mentioned task will be sent to.

In catalog item field called requested for (reference field), in user form the location field is reference and in location form the hub field is single line and in task assignment group field is reference