Hello,
I have two entities, lets say E1 and E2. In E1, there is a lookup field to the E2. I am storing the Guid of the E2 record selected as lookup in a field in the E1. (Converting Guid to string). Now , in another function I want to retrieve the E2 record by querying the field in which guid is stored in E1. I am doing the following :
string GuidOfE2record = e1["field in which guid is stored"].ToString();
var E2record = crmService.Retrieve(schemanameofE2, GuidOfE2record, new ColumnSet("name"));
However, I am facing issues because of string conversion. However , if I remove ToString(), (Tried Guid GuidOfE2record = e1["field in which guid is stored"];)I am facing error that it cannot convert object to guid. How do I solve this issue?
*This post is locked for comments
Thank you!
You can convert to Guid:
Guid recordE2Id = new Guid(e1["GuidFieldName"].ToString());
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156