Results 1 to 5 of 5

Thread: Get Display name of field value instead of its Label Name

  1. #1
    Mohnish Guest

    Question Get Display name of field value instead of its Label Name

    Hi,
    I wanted to get Display Name of the value in the drop-down field instead of it's Label Name. How can I get it...?

    Suppose, I created a drop-down having drop-down value as,
    Label Name: IN and Display Name: India

    Then,in Logic Hook I used "$bean->{Field_Name}" to extract Field Value But it shows Label Name(IN) but I want Display Name(India).
    So, Is it possible to get it, if so How......??
    Please tell me....

    Thanks In Advance!!

  2. #2
    dkallish@sugarcrm.com Guest

    Default Re: Get Display name of field value instead of its Label Name

    Hello Mohnish,

    A Logic Hook is going to pull that data directly from the database, which stores the Item Name value, in your example 'IN,' rather than the Display Label.

    Display Labels for each Item Label are stored in the following location:

    ./custom/include/language/<Localized Language>.lang.php - For customized Drop Down Menus.
    ./include/language/<Localized Language>.lang.php - For stock Drop Down Menus.

    I'm not familiar enough with building Logic Hooks to provide a way to access this file and pull the Display Label, but I believe these files would need to be referenced in some way to swap the Item Name for the Display Label.

    Hopefully someone can provide additional insight from the coding standpoint.

    Kind regards,

    Dan Kallish
    SugarCRM Technical Support Engineer

  3. #3
    hats Guest

    Default Re: Get Display name of field value instead of its Label Name

    Hello Mohnish,

    Yeah Dan is right. It fetches the value of database in logic hook which stores the item name in db.

    I hope you must have known the name of the list, so you can load it in logic hook using $GLOBALS. If your list name is test_list then it would look like:

    $myArr = $GLOBALS['app_list_strings']['test_list'];
    Please let us know if it helps.

    Cheers.

  4. #4
    Mohnish Guest

    Default Re: Get Display name of field value instead of its Label Name

    Hi Dan,
    Thanks for your suggestion, it helps a bit...

    Cheers.

  5. #5
    Mohnish Guest

    Default Re: Get Display name of field value instead of its Label Name

    Quote Originally Posted by hats View Post
    Hello Mohnish,

    Yeah Dan is right. It fetches the value of database in logic hook which stores the item name in db.

    I hope you must have known the name of the list, so you can load it in logic hook using $GLOBALS. If your list name is test_list then it would look like:



    Please let us know if it helps.

    Cheers.
    Hi buddy,
    Thanks for your help. It works, I did like this:
    $var_name = $bean->field_name;
    $array = $GLOBALS['app_list_strings']['dom_name'];
    echo $array[$var_name];
    Cheers.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unable to set Display Label
    By phasecode in forum Developer Help
    Replies: 1
    Last Post: 2013-09-18, 08:18 AM
  2. how to Display only the label name?
    By saj123 in forum Help
    Replies: 4
    Last Post: 2013-04-25, 09:42 AM
  3. Getting display label
    By eydn in forum Developer Help
    Replies: 2
    Last Post: 2012-03-26, 01:26 PM
  4. Showing System Label NOT Display Label
    By banning in forum Help
    Replies: 6
    Last Post: 2011-09-19, 09:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •