
- 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-14-2016 02:31 AM
You can use the attribute - ref_ac_columns - listing the fields which should display in the reference picker -
Auto-Complete for Reference Fields - ServiceNow Wiki
Dictionary Attributes - ServiceNow Wiki
ref_ac_columns | list of field names separated by semi-colons | any reference field with an auto completer (see ref_auto_completer) | Specifies the columns whose display values should appear in an auto completion list in addition to the name. See the cmdb_ci field ("Configuration Item") on the Incident form for a working example. |
Mark if it is helpful or correct, feedback is apprciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 07:12 AM
Thanks for the answer
the solution you have suggested is not what i want, in your case there is an autocompleter and the field is not a tree picker, so it suggest just columns names in when you search.
what i want is to get the full name (parent1/parent2/parent3/son) when clicking the son in the tree.
for example: for the field location, we can choose the location as a tree:
if i click "401 Crestwood Blvd, Birmingham AL" i get this into the field:
but i can configure my form to get the full name of the location, i mean all parent of that location like this:
in servicenow this option is available for the location field, the location field by default has tree picker as true in its attributes.
So the question is how i can do that for my own field , i want to add a field and configure its tree picker attribute as true, and get the full name
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 07:25 AM
Thanks for explaining in detail, I think you have to follow an heirarchy in constructing the new table.
In the new table, there should be a parent field which refer to its own self, like in Location table -
In the new table, enter a top record, for example
- Americas,
- then North Americas (Americas will be parent for this record)
- then California (North Americs will be parent...) etc.
And when you refer this new table anywhere, please make tree_picker = true. I think this will list the new table's records in heirarchial way -
Hope this helps -
There is parent field which is reference to location table itself.
Mark if it is helpful or correct, feedback is appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 07:51 AM
Thank you Srikanth for your answer, but i think you still don't undetstand the question, i have already did the same schemat, i have a parent that
refer to same table, i made that in success.
try to configure the form layout and add the location and the location.full_name and you will understand my question.
after choosing you should have this result:
location: (what you choosed only) ex: new york
full name: (all parent) ex: Americas/USA/new york
thank you so much.