
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 02:28 AM
Hi,
Im trying to get the full name when choosing several parent in a field the has tree_picker = true;
for example: The location field is configured as a tree by default so when you choose a a city for example you get just the name of the city but you have configured your field by (location.full_name) you get the city and its country.
do you have any idea how i can do that please.
thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 11:01 AM
Hi Adil,
I have implemented in my local system and everything is working fine.
Please find the details of the implementation -
The table definition as follows - Parent field should have an attribute tree_picker = true
The Full Name column should be calculated and code should be like this -
FYI, the code below -
(function() {
var resultName = current.u_name;
var parentId = current.u_parent;
if (!gs.nil(parentId)) {
var grParent = new GlideRecord('u_location_sri'); //write your table here
grParent.addQuery('sys_id', parentId);
grParent.query();
if (grParent.next()) {
resultName = grParent.u_full_name +"/"+current.u_name;
}
}
return resultName;
})()
I have inserted few records to test the functionality and everything is working fine -
I think your issue is resolve, hopefully
Mark if it is correct or helpful.
Tomorrow, I will try to give you the details of creating the table without column name starting with 'u_'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 02:04 AM
Hi Adil,
Please try out the answer, and I would like to know did we finally slayed the dragon or not
Finally, you can mark this answer as correct, if it works fine.
I hope so, it should work as it worked in my local instance.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 02:51 AM
Really its great to hear, that every thing worked out. Sure I would like to answer your questions -
gs.nil('<anyvariable>') - this compares if the given variable is NULL or not i.e empty or not
In our case, I am checking if the parent field for that particular record is empty or not and on the basis of that I am entering the if clause.
As we are implementing through calculation field, the calculation automatically happens, try to change the name of the record, it automatically calculates the full name accordingly. As everything happening in server side, we dont have to use g_form.
System Dictionary - ServiceNow Wiki
Please mark the answer as correct, so that it will be easy for others to search the community next time.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 04:28 AM
yes of course i'll do that , and thank you so much, you are realy amazing thank you again !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 04:34 AM
Hi Adil,
Could you please mark my answer as correct, not the question as answered. In that way, the correct answer will sit at the top immediately next to the question, which will help in future to search in the community.
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2016 10:26 AM
i have already did that, is not ?