2

I have a problem with querying records of an entity type activityparty. I use the request to GET /api/data/v.../activityparties?$select=activitypartyid,partyidname but it fails with the error:

{ "error":{ "code":"0x0", "message":"Could not find a property named 'partyidname' on type 'Microsoft.Dynamics.CRM.activityparty'." } }

Those two activitypartyid and partyidname field names I got from the request to EntityDefinitions('activityparty') .

... "PrimaryIdAttribute": "activitypartyid", "PrimaryImageAttribute": null, "PrimaryNameAttribute": "partyidname", ...

Then I query EntityDefinitions('activityparty')/Attributes to know is there a partyidname attribute. I found there one interesting field 'IsValidODataAttribute' = false. Does it mean that this field could be in JSON or could not be? And what does it mean exactly? I suppose the problem is in this case, otherwise I do not know what I am doing wrong :)

whole representation of one activityparty entity record:

{  
   "@odata.etag":"W/\"2392630\"",
   "_ownerid_value":"68682bd9-701b-460a-a383-c6d38a8d25ae",
   "activitypartyid":"b0f76c9b-49b9-45ca-b15c-0179a421f680",
   "participationtypemask":9,
   "_activityid_value":"7418ab6b-fbd2-e911-a993-000d3a3a1688",
   "ispartydeleted":false,
   "versionnumber":2392630,
   "scheduledend":"2019-09-08T12:00:00Z",
   "_partyid_value":"68682bd9-701b-460a-a383-c6d38a8d25ae",
   "scheduledstart":"2019-09-08T12:00:00Z",
   "instancetypecode":0,
   "addressusedemailcolumnnumber":null,
   "donotemail":null,
   "donotfax":null,
   "addressused":null,
   "_resourcespecid_value":null,
   "exchangeentryid":null,
   "donotphone":null,
   "donotpostalmail":null,
   "effort":null
}
Pavlo Mykhailyshyn
  • 203
  • 1
  • 6
  • 20

1 Answers1

0

I guess you are looking for this below web api call.

You should use _partyid_value@OData.Community.Display.V1.FormattedValue for expected result.

Xrm.WebApi.online.retrieveMultipleRecords("activityparty", "?$select=activitypartyid,_partyid_value").then(
    function success(results) {
        for (var i = 0; i < results.entities.length; i++) {
            var activitypartyid = results.entities[i]["activitypartyid"];
            var _partyid_value = results.entities[i]["_partyid_value"];
            var _partyid_value_formatted = results.entities[i]["_partyid_value@OData.Community.Display.V1.FormattedValue"];
            var _partyid_value_lookuplogicalname = results.entities[i]["_partyid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
        }
    },
    function(error) {
        Xrm.Utility.alertDialog(error.message);
    }
);

Recommended to use CRM REST Builder for error free web api syntax & payloads.

  • I need proper display name for this entity type. As far as I know the attribute 'PrimaryNameAttribute' from entity definition means display name for this type of entity. For example 'account' entity type has 'PrimaryNameAttribute' equal 'name', so now I can easily execute the request /api/data/v.../account?$select=accountid,name to find all necessary info. – Pavlo Mykhailyshyn Oct 02 '19 at 06:56
  • but for 'activityparty' entity I cannot do it, cause 'partyidname' missing there. What should I do with this strange behavior? – Pavlo Mykhailyshyn Oct 02 '19 at 06:57
  • @PavloMykhailyshyn this is not strange, this is Dynamics Activity :) Activity is so complex in design, which includes Activity Party & Activity Pointer, this is the way it has to be queried. – Arun Vinoth-Precog Tech - MVP Oct 02 '19 at 11:18
  • @PavloMykhailyshyn Are you looking for subject attribute in all Activity types ? Check it. – Arun Vinoth-Precog Tech - MVP Oct 02 '19 at 12:03
  • Yes, exactly! What should I check? – Pavlo Mykhailyshyn Oct 02 '19 at 12:45
  • It is not only 'activityparty' entity which has this problem. I want to achieve the same result (to get subject) for another entity types but it also fails. here is entity list with the same error "code":"0x0","message":"Could not find a property named" customerrelationship knowledgearticleviews postfollow customeropportunityrole knowledgearticleincident – Pavlo Mykhailyshyn Oct 02 '19 at 13:07
  • @PavloMykhailyshyn ok show your actual code & explain what you are doing. – Arun Vinoth-Precog Tech - MVP Oct 02 '19 at 13:19
  • I would like to get for all entity types human-readable name, display name or smth that I can use for title or subject for specific entity records. – Pavlo Mykhailyshyn Oct 02 '19 at 13:29
  • No code :) Only use the request to GET /api/data/v.../activityparties?$select=activitypartyid,partyidname . I selected partyidname to get human-readable name for this entity type. This attribute I got from EntityDefinition request – Pavlo Mykhailyshyn Oct 03 '19 at 08:38
  • 1
    @PavloMykhailyshyn unfortunately there is no "one size fit all" concept for all CRM entities. :) you may need to tailor different logic for different entities, this is huge ERP product designed in different point of time for different concepts.. so we have to use documentation & help from community to achieve what we want.. :) http://missdynamicscrm.blogspot.com/2014/09/deciphering-the-relationship-activitypointer-activitytype-phonecall-appointment-activityparty-crm-2011-2013.html – Arun Vinoth-Precog Tech - MVP Oct 03 '19 at 15:29