Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How get all fields from lookup value

Posted on by

Hello!

I have a lookup field that is related to contact in the call entity. How I can get all fields (mobilephone, address, etc.) from lookup value in js-script? My code:

 var myresult;
 var contact = parent.Xrm.Page.getAttribute("iw_contact").getValue();

 XrmServiceToolkit.Rest.Retrieve(
                contact[0].id,
                "ContactSet",
                "",
               null,
               function (result)

                {
                    myresult = result;
                },
               function (error)

                {
                    alert(error.message);
                },
                   false
                );

alert(myresult.length);

Could somebody help me?

*This post is locked for comments

  • RE: How get all fields from lookup value

    Thanks to all! I have solved this problem.

    Debugger  helped me find a bag. In general, I forgot add one js-library.

  • Verified answer
    Hosk Profile Picture
    Hosk on at
    RE: How get all fields from lookup value

    are you returning values in Javascript

    has the guid got a value

    http://sumedha8.blogspot.co.uk/2014/03/rest-functions-from-xrmservicetoolkit.html

    you need to debug the javascript to make sure the fields are right

  • RE: How get all fields from lookup value

    I replaced "" with null but this didn't help

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How get all fields from lookup value

    Try to replace "" with null in your function call.

  • RE: How get all fields from lookup value

    Thanks, Rajkumar Rajaraman, I will look

  • RE: How get all fields from lookup value

    I don't know how get all field from lookup value

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How get all fields from lookup value

    Put these alerts to check if values are coming in result

    alert(myresult.MobilePhone.Value)

    alert(myresult.address1line1.Value)

  • Suggested answer
    Rajkumar Rajaraman Profile Picture
    Rajkumar Rajaraman 18,108 on at
    RE: How get all fields from lookup value

    Refer this thread:

    community.dynamics.com/.../107172

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How get all fields from lookup value

    Anatoliy,

    What kind of issue do you experience?

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans