Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Plugin lookup

(0) ShareShare
ReportReport
Posted on by 1,703

I have a plugin which reads a file and extracts data from several crm entities to create a new record in a third entity

when I query the lookup field in entity a, I get a string of the id back into the plugin, how do I convert this back to a entity reference to insert in to the new record in entity B

I have tried

Dim LicenceGuid As New Guid

Guid.TryParse(ImportReturnElements(2).ToString, LicenceGuid)

but that throes up an exception

 

 

*This post is locked for comments

  • Verified answer
    abvogel Profile Picture
    150 on at
    RE: Plugin lookup

    TryParse should be able to parse it and set the value to LicenseGuid. Can you confirm that "ImportReturnElements(2).ToString" returns a valid string? Should it be .ToString()?

  • Verified answer
    Yadnyesh Kuvalekar Profile Picture
    4,102 on at
    RE: Plugin lookup

    EntityEeference er = new EntityEeference("entitylogicalname",new Guid("string guid"));

  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at
    RE: Plugin lookup

    Hi PeteN,

    Please look at the following example, I think this is what you need to do:

    [View:https://msdn.microsoft.com/en-us/library/gg509009.aspx:750:50]

    It shows very similar examples of connecting products to the opportunity.

    // Create another catalog product and override the list price

    OpportunityProduct catalogProductPriceOverride = new OpportunityProduct

    {

         OpportunityId = new EntityReference(Opportunity.EntityLogicalName,

           _opportunityId),

         ProductId = new EntityReference(Product.EntityLogicalName,

           _product2Id),

         UoMId = new EntityReference(UoM.EntityLogicalName, _defaultUnitId),

         Quantity = 3,

         Tax = new Money(2.88m),

         IsPriceOverridden = true,

         PricePerUnit = new Money(12)

    };

    Hope this helps.

    Thanks,

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
dkrishna Profile Picture

dkrishna 6

Featured topics

Product updates

Dynamics 365 release plans