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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Nagaraju_Matta Profile Picture

Nagaraju_Matta 119

#2
ManoVerse Profile Picture

ManoVerse 78 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans