web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at

    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,

  • Verified answer
    Yadnyesh Kuvalekar Profile Picture
    4,102 on at

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

  • Verified answer
    abvogel Profile Picture
    150 on at

    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()?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans