how to get full name for tree picker

Adil JEBLI
Mega Expert

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.

1 ACCEPTED SOLUTION

ghsrikanth
Tera Guru

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


Screen Shot 2016-03-14 at 11.27.01 PM.png



The Full Name column should be calculated and code should be like this -



Screen Shot 2016-03-14 at 11.27.29 PM.png



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 -



Screen Shot 2016-03-14 at 11.28.32 PM.png



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_'


View solution in original post

21 REPLIES 21

Thanks for your feedback.


you are welcom, can please participate in this:
how to add checkbox and radio button fields in a form ?