0

Here is a question. Every order has some receipt item and it has 1(order) to N(receipt item) relation with receipt item. I wanna check that if there is any record in receipt item of order entity or not. How can it be possible? I do like this happen in onload of the order and via JS, not workflow or something like that. I wanna set a button to Enable/Disable if there is any receipt item, so I need onload JS. Is it possible? If yes how? Any help or link? or sample?

Note that I have installed CRM 2011 on-permise.

Alireza
  • 179
  • 1
  • 2
  • 11
  • [Jason Lattimer's CRMRESTBuilder](https://github.com/jlattimer/CRMRESTBuilder) can help you build the query you're looking for. – Aron Jul 22 '18 at 12:44
  • It's definitely possible. You're using CRM 2011, so quite old. Try to build the query you want in FetchXml first, then you can use JavaScript to execute the same query – jasonscript Jul 23 '18 at 02:10

1 Answers1

0

Use the REST endpoint to get the data in javascript. There is plenty of exemple on the web. https://learn.microsoft.com/en-us/previous-versions/dynamics-crm2011/developers-guide/gg334279(v=crm.5)

Your query shoud look like this: [Your Organization Root URL]/xrmservices/2011/organizationdata.svc/salesorderdetails/?$select=[Put the columns you want]&$filter=orderid eq (guid'" + orderId + "')

Nick
  • 735
  • 5
  • 14