Friday, 19 January 2018

CRUD with Odata and Data entities in Dynamics 365 for operations - CREATE, UPDATE and DELETE Operations

You can use POSTMAN or FIDDLER for any of the testing. I personally like POSTMAN.

I assume that you have already gone through pages on READ operations. If not, please go through all that for better understanding of upcoming discussion on CREATE,UPDATE and DELETE operations in Dynamics 365 for operations(D365O).

Reading through data entities was fun, isn't it. But as a developer you must be willing to do more than just reading the data using Data entities.

Microsoft has done commendable work in whole data entity framework in D365O, it now can be used as point of entry for other operations such as create, update and delete. This a big relief considering AIF is practically a history for D365O.

Although there are other ways also to deal with data inside D365O, I find using Data entities the easiest.

I have created a custom table named 'BeaconService' for my testing purpose.

1. CREATE operations:

In Odata terminology, D365 CREATE operation can be referred as POST operation. Yes, you are right, that means you have to setup a method type to POST.

URL would look like this

https://*******devaos.cloudax.dynamics.com/data/Beaconservice

Set the Authorization code prefixed by 'bearer'

Then Set the body, keeping mandatory fields like BeaconID(in my case) and dataareaId as shown below.

{
      "EndTime": 0,
      "BeaconNum": "DA:AF:A9:FD:Y6:T4",
      "OfferId": "ST100006",
      "Description": "25% flat discount for your amazing audio experience",
      "EffectiveDate": "2015-12-25T12:00:00Z",
      "StartTime": 0,
      "dataAreaId": "usrt",
      "Category": "Headphones",
      "Offer": "headphones on discounted rate",
      "Brand": "Sony"
}



Now execute it (click on Send button if using POSTMAN).
This will give same output on the postman and error if any. Now you can go to the database or D365 screen to see the data.

2. UPDATE Operations


In Odata terminology, D365 UPDATE operation can be referred as PATCH operation.
i.e., you have to setup method type as PATCH.

URL would look like this
https://*******devaos.cloudax.dynamics.com/data/Beaconservice(BeaconNum='DA:AF:A9:FD:Y6:T4',dataAreaId='usrt')

Difference in the URL as you can see is, you'll have to include your primary key along with datareaid.

Now, Set the Authorization code prefixed by 'bearer'

Then Set the body as below, here you do not have to include primary keys

{
    "Category": "Earphones"
}


Now execute it (click on Send button if using POSTMAN).
This will leave the output screen blank if succeeded and error if any. Go ahead and verify the data.

3. DELETE Operations


In Odata terminology, D365 UPDATE operation can be referred as DELETE operation.
i.e., you have to setup method type as DELETE.

URL would look like this
https://*******devaos.cloudax.dynamics.com/data/Beaconservice(BeaconNum='DA:AF:A9:FD:Y6:T4',dataAreaId='usrt')

Here also, you'll have to include your primary key along with datareaid.

Now, Set the Authorization code prefixed by 'bearer'

Leave the body blank here. 


Then execute it (click on Send button if using POSTMAN).
This will leave the output screen blank if succeeded and error if any.
--------------------------------------------------------------------------------------

I am done here.
Thanks for your time!!!
Shoot the message if anything is missing or needed to be modified.

Saturday, 13 January 2018

DIXF for Multiple AOS running on Single Server for AX 2012

Reg DIXF, AX installer does not allows to configure DIXF if you are going ahead for 2nd AOS on same server.

Luckily, I've got some workaround.

Just open the server installation folder for older AOS where DIXF is working, and copy 3 files as mentioned below
Server path : C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin

Files to be copied:
1. Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.dll
2. DMFClientConfig
3. DMFConfig

And the paste these files as it is in Bin folder of other server.

That's it! You are done, open AX and do rest of the DIXF setup and play around.