Converting sys_id to a value

Tim Wmson
Giga Expert

I'm creating a catalog item to ask the submitter what group they want a user added to. I have it working except it returns the   sys_ID of the group to the Incident summary field. How do I convert this to the group name?

1 ACCEPTED SOLUTION

Ahmed Drar
Tera Guru
Tera Guru

Hi , if you set the group's name as Display value then getDisplayValue() is the solution for you or you can try var gr = new GlideRecord('sys_user_group');   if (gr.get(groupID))// add group ID here {   // gr.name returns group's name }


View solution in original post

14 REPLIES 14

I Tried this also current.v_members.getDisplayValue() in UI Action it is showing current is not defined

 

Hi Rajasekar

That is leading me to wonder, if you are using the correct value (maybe it has changed or it is a new variable?) - for the variable "v_members". Check to see if the value is exactly the same as you write in the script.

Also, check these link, that might help you.

https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/

https://community.servicenow.com/community?id=community_question&sys_id=4b9b4f61db9cdbc01dcaf3231f96...

 

Thank you so much Jesper,

Finally i am able to fetch Display value below is the code.

When i tried with current.v_members.getDisplayValue()i am getting Undefined error

This is working now current.variables.v_members.getDisplayValue()

In point 3. How to get the display value of the gr?

Rajasekar4
Tera Expert

I am trying to Fetch the variable and include UI Macro Button on fiedl.can any one help me on this

function onLoad() {
try{
var field ='v_members';
var field = g_form.getControl(field);
$(field).insert({
after: '<a onclick="doSomething()" name="my_custom_macro" id="my_custom_macro"><img src="images/warning.gifx" alt="Show Macro" title="Show Macro" style="padding-right:4px"></a>'
});
}
catch(e){
alert('Error');
}
}

//onclick event to fire when the image is clicked
function doSomething() {
alert('You clicked me!');
}

 

I am getting undefined error. 'V_Members' is a variable type List Collector.