- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 01:13 AM
Hi Heroes,
I am struggling to fetch a lookup select box field value. The variable is called "existing_pcc_code", with two lookup label fields "u_id" and "u_name".
I want to query the u_id and find the record that matches the u_id field on the table. Then I want to take the value from the u_project field and enter it into the task short description.
Task activity script in workflow:
if(current.variables.specify_type_of_request == 'modify_pcc_code'){
var gr = new GlideRecord('u_work_order');
gr.addQuery('u_id','CONTAINS', current.variables.existing_pcc_code.u_id);
if(gr.next()){
var proj = gr.u_project;
task.short_description = current.short_description + ". ** Project: " + proj;
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 01:21 AM
Hello,
The lookup select box variable can have multiple display labels but it can only have a single value at the backend which is the value of field selected in Lookup value. You need to set it as u_id and then try this script
if(current.variables.specify_type_of_request == 'modify_pcc_code'){
var gr = new GlideRecord('u_work_order');
gr.addQuery('u_id','CONTAINS', current.variables.existing_pcc_code);
if(gr.next()){
var proj = gr.u_project;
task.short_description = current.short_description + ". ** Project: " + proj;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 01:21 AM
Hello,
The lookup select box variable can have multiple display labels but it can only have a single value at the backend which is the value of field selected in Lookup value. You need to set it as u_id and then try this script
if(current.variables.specify_type_of_request == 'modify_pcc_code'){
var gr = new GlideRecord('u_work_order');
gr.addQuery('u_id','CONTAINS', current.variables.existing_pcc_code);
if(gr.next()){
var proj = gr.u_project;
task.short_description = current.short_description + ". ** Project: " + proj;
}
}