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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Guid contains data on SQL but appears null in plugin (Exception caught - Expected non-empty Guid.)

(0) ShareShare
ReportReport
Posted on by 17

Hello,

I am trying to get all members (leads) of a static marketing list in order to qualify them as Contacts.

The problem is that the guid value of members [entityid appears to be null. The error I get is: Exception caught - Expected non-empty Guid.

Here is proof that entityid is not null:

pastedimage1670583976707v1.png

Below is my code:

                                QueryExpression queryListMembers = new QueryExpression("listmember");
                                queryListMembers.Criteria.AddCondition("listid", ConditionOperator.Equal, new Guid("fb559388-f376-ed11-81ab-6045bd8f9f3b"));
                                EntityCollection collectionMembers = serviceClient.RetrieveMultiple(queryListMembers);

                                if(collectionMembers.Entities.Count > 0)
                                {
                                    Console.WriteLine(collectionMembers.Entities.Count.ToString());
                                    foreach (Entity member in collectionMembers.Entities)

                                    {
                                        QualifyLeadRequest request = new QualifyLeadRequest();
                                        request.CreateAccount = false;
                                        request.CreateOpportunity = false;
                                        request.CreateContact = true;
                                        request.LeadId = new EntityReference("lead", member.GetAttributeValue("entityid")); // This is null. Tried also with member.GetAttributeValue("entityid").Id 
                                        request.Status = new OptionSetValue(3); // Qualified

                                        QualifyLeadResponse qualifyResponse = (QualifyLeadResponse)serviceClient.Execute(request);

                                    }
                                }

I have the same question (0)
  • RodRodriguez Profile Picture
    on at

    On line 5, check and see if the IDs are in the CollectionMembers, if not, then take a closer look at what it happening on line 3

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    You forgot to add ColumnSet to your query, so it returns nothing but listmemberid values. Try the following:

    QueryExpression queryListMembers = new QueryExpression("listmember");

    queryListMembers.ColumnSet = new ColumnSet("entityid");

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans