Deactivating Dynamics 365 records in PowerApps Canvas App

Free PowerApps Dynamics 365 Training Guide:

Deactivating Dynamics 365 records in PowerApps Canvas App

You can try this possible solution here

If you want to try to do it from the Canvas App directly and not from a Flow:

Try Patch from PowerApps Canvas with the values it expects for "statecode" attribute of the entity.*

Remember it’s not called Active or Inactive in Dynamics. You may need to actually patch a number of zero or one.

Example: Account Entity Reference:

Dynamics 365 PowerApps Canvas App Training

NOTE: This may or may not work to Patch the statecode from PowerApps to the Common Data Service record, it may depend onthe circumstances and it may depend on some caveats, and due to those circumstances it is best to try it yourself now with a grain of salt – this may or may not work. If you need help you can contact us for more info

Also NOTE: If the above doesn’t work with Dynamics 365 data source- try the above instead using the Common Data Service data source. You are able to use Common Data Service source while using Dynamics 365 – in fact we recommend you use Common Data Service over Dynamics 365 in all Flows (especially Power Automate or Flow because you can set the "Current" environment as the scope in all the Flow Actions, making the solution more portable), as well as PowerApps Canvas Apps.

If it works, you can deactivate Dynamics 365 record without even using a Flow and by using PowerApps Canvas App directly!

See more Dynamics 365 PowerApps Canvas App Training

PowerApps UpdateContext Function Not Working

Issue: Microsoft PowerApps UpdateContext Function Not Working.

Suppose that you are trying to use a PowerApps Canvas App button in order to update a DataCardValue in a particular new form inside of your PowerApp such as your Canvas PowerApp. However something you may run into is that the UpdateContext function may not seem to be working for your use case. Suppose you want to take an existing value of a particular DataCardValue, and, say, do something simple like increase it by 1 when a button is pressed.

PowerApps UpdateContext Not Working Possible Solutions

You may have tried:

UpdateContext({DataCardValueSubject77: DataCardValue77.Text + 1})

*note – pseudocode – not intended to be exact or accurate – just to illustrate the general idea

Maybe you tried leaving out the .Text part but without much success in that regard. Maybe you went wild and even tried something like using the Sum function with another label like AddPlusOne label, so you might end up with something like the following:

UpdateContext({DataCardValueSubject77: Sum(DataCardValue77.Text, AddPlusOne.Text)})

*note – pseudocode – not intended to be exact or accurate – just to illustrate the general idea

You may be dealing with a variety of DataCardValue values that could be either empty or that end up having a zero (0) inside of these card values. You may have considered it being OK to put in zeroes (0’s) as a potential default value in your case and that this may have been fine with you just to get it to work.

Even if you got very far, you may end up getting the following issue as well:

"Incompatible type. We can’t evaluate your formula because the context variable types are incompatible with the types of values in other places in your app."

We can help with the above issue as well. Please continue reading for the actual solutions to your PowerApps problems so you can become more productive with Power Platform and PowerApps.

PowerApps UpdateContext Not Working Actual Solution

We have actual solutions for your issue where you encountered "PowerApps UpdateContext Not Working" for your case. We have two options for you that are available right now, with Option 2 probably being better for you: