XrmDefinitelyTyped icon indicating copy to clipboard operation
XrmDefinitelyTyped copied to clipboard

XrmQuery.create with associated entity

Open JonathanWacks opened this issue 5 years ago • 1 comments

Is there a way to create associated entities at the same time as the primary entity? This is possible through normal WebApi - e.g.

{
 "name": "Sample Account",
 "opportunity_customer_accounts":
 [
  {
      "name": "Opportunity associated to Sample Account",
      "Opportunity_Tasks":
      [
       { "subject": "Task associated to opportunity" }
      ]
  }
 ]
}

What does the corresponding call look like in XrmQuery? I have tried using the 'xxxResult' interface, but a) that requires specifying fields like odata.etag, createdby_guid, etc. and b) it throws an error. Am I missing something, or is there a missing piece of functionality here?

JonathanWacks avatar Feb 11 '19 14:02 JonathanWacks

It was definitely meant to work, but there seems to be an error. XDT tries to reuse as many types as possible, but it seems that two intentions with the same type has clashed. The fix is to look at other parts that use xxx_Result and figure out whether those should get a new type, or if the required fields on the xxx_Result type are actually necessary. If they're not necessary, they can be made optional by adding ? to the attribute in xxx_Result.

magesoe avatar Feb 11 '19 14:02 magesoe