d365collaborative / d365bap.tools

Tools used for Business Application Platform, One Dynamics One Platform - D365FO + Dataverse
MIT License
15 stars 4 forks source link

Handle Set-BapEnvironmentVirtualEntity change tracking for invisible entity more gracefully #20

Open FH-Inway opened 6 months ago

FH-Inway commented 6 months ago

Per Prerequisites to track changes for finance and operations virtual tables in Dataverse, the virtual entity must be visible in Dataverse before change tracking can be enabled.

When calling Set-BapEnvironmentVirtualEntity -EnvironmentId $environmentId -Name $virtualEntitiesName -TrackingOn for an entity that is not visible, you get a cryptic error message.

Invoke-RestMethod: s:ClientCould not find an entity with name mserp_myentity and id 00000000-0000-0000-0000-000000000000

Set-BapEnvironmentVirtualEntity should check the visibility of the entity first when -TrackingOn is used. If the entity is not visible, the cmdlet should give the user an appropriate warning message.

In addition, Set-BapEnvironmentVirtualEntity should give a warning message for -VisibilityOff in combination with -TrackingOn. Currently, this only makes the entity invisible without any hint that tracking was not enabled.

Splaxi commented 6 months ago

I didn't know that!

We should aim to guide and support the user to use things as they are provided by Microsoft documentation.

I'm translating this into the following supported scenarios: -VisibilityOn -TrackingOn - but with a validate, or even better - just handle it seamless for the user, like do -VisibilityOn wait for that the reflect and then run -TrackingOn again -VisibilityOff (TrackingOn==$true) - but with a validate, or even better - just handle it seamless for the user, setting both properties at the same time

AurelienClere-365 commented 2 weeks ago

Hello guys, joining a little late on this topic ... but happy to help if needed

All the virtual table part is now standard now (refresh metadata/schema at each F&O deployment), activation too. https://jatomas.com/en/2024/05/24/automatic-activation-of-virtual-tables-in-d365fo/

The only thing I don't know yet is the tracking changes, which could be great to have here in order to be available right away for Synapse Link purpose in Dataverse.

Aurelien