Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

USD - Getting Lookup field text value

Posted on by 1,258

6663.USD.PNG

I would like to get the value "Philippines" from the lookup field. Currently, what's being displayed is the whole lookup with its GUID and schema.

*This post is locked for comments

  • Verified answer
    MRVIX Profile Picture
    MRVIX 1,258 on at
    RE: USD - Getting Lookup field text value

    Hi All,

    Thank you for your inputs! I have achieved my desired output in USD by creating an Action Call: Run Script

    function getCountryText() {
    var country = "[[lead.pre_ountry]+]";

    var splitCountry = country.split(",");
    var countryText = splitCountry[2].slice(0, -1);


    return countryText;
    }

    getCountryText()

    1070.Get-Lookup-Text_2800_runscript_2900_.png

  • MRVIX Profile Picture
    MRVIX 1,258 on at
    RE: USD - Getting Lookup field text value

    Hi, the country field from the parameters returns schema+GUID+text, I'm thinking on how can I get the text throught USD parameters.

    e.g. [[country.countrytext]]

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: USD - Getting Lookup field text value

    function getCountryName()

    {

    var country = Xrm.Page.getAttribute("new_countrylookupfield").getValue();

    if (country != null)

    {

    var countryname = country[0].name;

    }

    }

    The name of the country, such as "Philippines" is then stored in the countryname variable and you can use it in a string field.

    Rich

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: USD - Getting Lookup field text value

    Hi,

    I think you are adding the all lookup object to your text. You only need to add the name part of the lookup object. A lookup object is composed of 3 values:

    1. id

    2. entityname

    3. recordname.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans