Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Lookup in Dynamics 365

Posted on by 1,075

Hello Community Experts,

There is an issue where i need to comment out the lookup fields because they were created programmatically and now those lookups are causing error!

I have knowledge only about the OOB lookup

They say they have two lookups for instance TestAccount and TestContact and when account is selected its related contacts are displayed but at the same time when account is selected it will throw script error

Since i do not have access to anything related to the above could you please guide me on how to create look-ups programmatically so that when i see their code i can comment those out

Please guide experts,

Best Regards,

Sumaira Noor

  • Jisung Han Profile Picture
    Jisung Han on at
    RE: Lookup in Dynamics 365

    Hi Sumaira Noor,

    Will you use Plugin or Javascript? Here is Plugin code to get/set Lookup field values:

    Get Value of Lookup fields

    EntityReference entref = (EntityReference)item.Attributes[attributeName];

    var LookupId = entref.Id;

    var logicalName = entref.LogicalName;

    Set Value of Lookup fields

    newAccount[attributeName] = new EntityReference(logicalName, LookupId);

    Set Null Value of Lookup fields

    newAccount[attributeName] = Null;

    Hope this helps. Thanks!
  • LuHao Profile Picture
    LuHao 40,872 on at
    RE: Lookup in Dynamics 365

    Hi Sumaira,

    we cannot analyze the error without the scripts or logs.

    If you are unable to share these due to permissions and privacy reasons, I would recommend you raise a ticket so that Microsoft support engineer will check the environment for you.

  • meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: Lookup in Dynamics 365

    Can you share script error logs ?  

    I can't figure it out.

  • Sumaira Noor Profile Picture
    Sumaira Noor 1,075 on at
    RE: Lookup in Dynamics 365

    Thanks for the response Mehdi, the problem is as they have sensitive data they have not given me access to anything

    Please guide

    Best regards,

    Sumaira Noor

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: Lookup in Dynamics 365

    Hi,

    Can you please share some screenshots ? 

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans