Cross-company behaviour for D365FO is supported in OData queries when using a get-record or get-records action in Azure Logic Apps.
"method": "get",
"path": "/datasets/@{encodeURIComponent(parameters('Dyn365fOURL'))}/tables/@{encodeURIComponent(encodeURIComponent('AVAItems'))}/items",
"queries": {
"$filter": "HasBeenExported eq Microsoft.Dynamics.DataEntities.NoYes'No' and MustBeExported eq Microsoft.Dynamics.DataEntities.NoYes'Yes' and dataAreaId eq '@{parameters('Dyn365fODataAreaId_STU')}'",
"cross-company": true
}
--> This returns only the records from the specified company!
However, the cross-company query filter does not seem to be taken into account in the update-a-record action...
"method": "patch",
"path": "/datasets/@{encodeURIComponent(parameters('Dyn365fOURL'))}/tables/@{encodeURIComponent(encodeURIComponent('AVAItems'))}/items/@{encodeURIComponent(item()?['dataAreaId'],',',item()?['ItemId'])}",
"queries": {
"$filter": "ItemId eq '@{item()?['ItemId']}' and dataAreaId eq '@{item()?['dataAreaId']}'",
"cross-company": true
}
--> This results in an error, meaning that the record could not be found. This is probably due to the fact that the system is looking in the default company of the executing user, even though the cross-company filter is specified.
Comments
To be honest, I stopped using the FnO connector. I use the plain HTTP connector instead.
Category: Data Management
Similar discussion here: https://powerusers.microsoft.com/t5/Connectors/D365-for-Finance-and-Operations-Enterprise-Edition-Get-a-record/m-p/89747#M497
Category: Data Management