Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Update into Look up field

Posted on by Microsoft Employee

how to transfer a string field values into lookup field using javascript

*This post is locked for comments

  • MNarmeen Profile Picture
    MNarmeen 1,846 on at
    RE: Update into Look up field

    I don't know why but someone deleted my post from this thread.

    Community moderators please look into it.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update into Look up field

    Thanks a lot Mahen, It's Working .

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Update into Look up field

    Hello,

    Assuming you are reading value from one lookup to another lookup Xrm.Page object, so it should be something like below:

    function setLookup()

    {

    if(Xrm.Page.getAttribute("sourcelookupfield")!=null &&

    Xrm.Page.getAttribute("sourcelookupfield").getValue()!=null)

    {

    var sourceLookup=Xrm.Page.getAttribute("sourcelookupfield").getValue();

    //get details from source lookup

    var lookupValue = new Array();

                               lookupValue[0] = new Object();

                               lookupValue[0].id = sourceLookup[0].id;

                               lookupValue[0].name = sourceLookup[0].name;

                               lookupValue[0].entityType = sourceLookup[0].entityType;

    Xrm.Page.getAttribute("targetlookupfieldname").setValue(lookupValue);

    }

    }

    thanks

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update into Look up field

    I need to read the lookup field values set the same values into another lookup field entity using  java script.

    and this is my code:

    entity.attributes['new_potentialcustomer'] = { id: Xrm.Page.getAttribute('sss_account').getValue()[0].id, logicalName: Xrm.Page.getAttribute('sss_account').getValue()[0].entityType, type: 'EntityReference' };

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update into Look up field

    I need to read the lookup field values set the same values into another lookup field entity using xrm javascript.

    and this is my code:

    entity.attributes['new_potentialcustomer'] = { id: Xrm.Page.getAttribute('sss_account').getValue()[0].id, logicalName: Xrm.Page.getAttribute('sss_account').getValue()[0].entityType, type: 'EntityReference' };

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Update into Look up field

    Could you provide some more information what you are trying to do ??

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans