Friday, June 10, 2022

D365 Dual Write FO/PSA Project integration for Project Stage in FinOps and Active/Inactive in CE.

We recently had a requirement to integrate projects between D365 Finance and Operations and D365 CE/PSA. 

In CE/PSA every table record can be active/inactive which is controlled by this logic Understanding StateCode, StatusCode, Status and Status Reason in Dynamics 365 - Carl de Souza. Looking at the article, you can see that the active/inactive is controlled by two fields statusCode and statusReason, which meant, dualWrite OData needs to send the value for both fields.

In D365 FO, you can have enum based project stage as Created,Estimated,InProcess,User1,User2,User3,Completed.

Now, say we want the project in FinOps with a status InProcess and User2 (Investigating) to be treated as active in D365 CE and all other as inactive, we have to map the value to the equivalent enum for both StatusCode and also StatusReason.


For StateCode (Project Status), we map in the following way.



Here is a JSON for easy copy paste

[
{
"transformType": "ValueMap",
"valueMap": {
"created": "1",
"estimated": "1",
"inProcess": "0",
"user1": "1",
"user2": "0",
"user3": "1",
"completed": "1",
"active": "0",
"inactive": "1",
"scheduled": "0"
}
}
]

Similary, the mapping with statusCode (Status Reason) will look like below.

Here is a json for status reason for easy copy paste.
[
{
"transformType": "ValueMap",
"valueMap": {
"created": "2",
"estimated": "2",
"inProcess": "1",
"user1": "2",
"user2": "1",
"user3": "2",
"completed": "2",
"active": "1",
"inactive": "2",
"scheduled": "1"
}
}
]


Hope it makes it clear for others as I could not find any documentation on these and the only way I could find this was randomly firing different values to CE using postman.

No comments:

Post a Comment