Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Unable to retreive Organizer element in appointments

Posted on by 230

Hi,

I'm trying to fetch a list of related appointments in VS C# so i can export them to our billing app. 

it works great except i can't retrieve the organizer element / attribute / (field) 

Here is the query.

i get this error: 

Code: -2147220970
Message: An unexpected error occurred.
Plugin Trace:Inner Fault: Has Inner Fault

if i comment out "organizer" then it work A1.

ActivityQry = new QueryExpression("appointment");
ActivityQry.ColumnSet = new ColumnSet("subject", "regardingobjectid", "scheduledstart", "scheduledend", "scheduleddurationminutes"
     , "description", "new_typeofwork"); // ,  "organizer"); <-- not sure why organizer throws error... not sure i need it
ActivityQry.Distinct = true;
ActivityQry.Criteria = new FilterExpression(LogicalOperator.And);                            
ActivityQry.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, ClosedIncident.Id);  // get related appointments  
RelActivities = (EntityCollection)service.RetrieveMultiple(ActivityQry);

  • Suggested answer
    Anthony A Profile Picture
    Anthony A 230 on at
    RE: Unable to retreive Organizer element in appointments

    Thanks for the leads, most of them point out how to retrieve the contents of a partylist, but for that I needed the get the  object  field first.

    I tried to read the field directly using a service.retreive with the GUID of the record, but for some odd reason my entityvar.Id was Null (my GUID for each record)

    I have no Logical explanation (someone?)  but the solution is to include "activityid" in the column set. once you add it, you can retrieve the organizer field.  the entityvar.id also gets populated.  I didnt need the activityid so i didnt put it in the query... i guess its a must!

    .

  • Suggested answer
    necsa Profile Picture
    necsa 3,455 on at
    RE: Unable to retreive Organizer element in appointments

    Hi,

    Please take a reference following links to find your solutions. I know the organizer is not serchable party list field. I didn't try but you can try with Entity collection method.

    community.dynamics.com/.../party-list-fields-in-dynamics-365

    www.c-sharpcorner.com/.../

    stackoverflow.com/.../how-to-get-the-contact-guids-from-a-partylist-in-a-plugin

    crmbusiness.wordpress.com/.../

  • Anthony A Profile Picture
    Anthony A 230 on at
    RE: Unable to retreive Organizer element in appointments

    Yes, but this code is external, its a small vs c# "app" that pull information from CRM and sends it to an external database for us to invoice customers in our Accounting App.

    I realized that its a party litst and i tried all 3 party list fields in the Entity and all 3 give me the same error.

    I am not sure if i need to use a different method to retreive the "partylistID" from the entity.

  • Suggested answer
    necsa Profile Picture
    necsa 3,455 on at
    RE: Unable to retreive Organizer element in appointments

    Hi,

    Is the organizer field on the Form?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans