Enable / Disable (turn on / turn off) multiple cloud flows using Code – Power Automate


Sharing a sample code through which we can Enable / Disable (turn on / turn off) multiple cloud flows using code.

E.g. here we want to turn on the below Cloud Flows owned by a specific user.

A screenshot of a computer

Description automatically generated

Table name – Workflow and Category – Modern Flow.

Below is the sample code, code is straightforward, we are updating the status of the record.

const string connectionString = "AuthType = ClientSecret; " +
                                         "Url = https://[org].crm.dynamics.com/;" +
                                         "ClientId=[GUID];" +
                                         "ClientSecret=[Secret]";

        var myServiceClient = new CrmServiceClient(connectionString);
        if (myServiceClient.IsReady)
        {
            var query = new QueryExpression("workflow");
            query.ColumnSet.AddColumns("workflowid", "name", "ownerid", "statecode", "category", "primaryentity", "solutionid");
            // Category = 5 (Modern Flow)
            query.Criteria.AddCondition("category", ConditionOperator.Equal, 5);
            // owned by a specific user
            query.Criteria.AddCondition("ownerid", ConditionOperator.Equal, "23d670c5-d02d-ee11-bdf4-0022482db7da");
            var cloudFlows = myServiceClient.RetrieveMultiple(query);
            foreach(var flow in cloudFlows.Entities)
            {
                var myFlow = new Entity("workflow", flow.Id);
                // statecode = 1 (Turn On) and  statecode = 0 (Turn Off)
                myFlow.Attributes["statecode"] = new OptionSetValue(1);
                myServiceClient.Update(myFlow);
            }        
        }

The result :

A screenshot of a computer

Description automatically generated

Check Work with cloud flows using code.

Hope it helps..

Advertisements

Fixed- Flow not getting triggered (Callback Registration)– Power Automate / Dataverse


Recently in one of our test environments, the out the box flow – “Deserialization of Inspection Definition” wasn’t getting triggered even when it was in the On state.

This was because the “CallbackRegistrationExpanderFilter” operation was failing with the below error.

Unexpected failure during ValidateUserAccessCached. Ex: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The specified user(Id) is disabled. Consider enabling this user. Additional Details: User IsDisabled=True, IsLicensed=True. ImpersonatingSystemUserId. (Fault Detail is equal to Exception details:

ErrorCode: 0x80040225

Message: The specified user(Id = xxxx-xxxx-xxxx-xxx-xxxxxx) is disabled. Consider enabling this user. Additional Details: User IsDisabled=True, IsLicensed=True. ImpersonatingSystemUserId=xxxx-xxxx-xxxx-xxx-xxxxxx)

TimeStamp: 2024-05-20T21:50:42.6724270Z

More on Callback Registration Expander Job – https://rajeevpentyala.com/2021/01/30/callback-registration-expander-system-jobs-waiting-for-resources/

This was because the flow’s corresponding Callback Registration record’s Owner was a user whose account was now disabled in CRM.

So the option to fix was to Turn off and Turn On the flow, which will delete the old callback registration record and will create a new one with the user who is turning off / on the flow. Updating the owner of the flow will not work here, as it won’t update the existing callback registration record.

Also we had another observation, if a callback registration is owned by a user who is a proper / enabled user in CRM, simply turning off and on the flow using a different user account will not delete the existing callback registration record and create a new one with that particular user as the owner. In this case we will have to explicitly delete the existing callback registration record.

Hope it helps..

Advertisements

Fixed – Resource not found for the segment action error – Power Automate / Dataverse


Recently we got the error for one of our flows – Resource not found for the segment ‘dow_ArtefactMoveNotesAttacmentToBlob’.

The flow was running fine with no errors a couple of days back.

On trying to edit the flow we can see it not listing the action in the Perform an unbound action step, instead giving “Request to XRM API failed with error: ‘ Message:Code:InnerError:’.

A screenshot of a computer

Description automatically generated

Eventually, as the error message suggests, we realized that the dev team had unregistered the action and registered a new action in its place. Updating the action to use the correct / new action fixed the issue for us.

A computer screen shot of a computer screen

Description automatically generated

The error could also show up if the action is in the disabled state.

https://community.dynamics.com/forums/thread/details/?threadid=1069c036-683b-4178-a592-6deae37002eb

https://community.dynamics.com/forums/thread/details/?threadid=1069c036-683b-4178-a592-6deae37002eb

Hope it helps..

Advertisements

How to – enable/disable the timeline highlights generated by generative AI – Dataverse / Model-drive Apps


With the Timeline highlights (Generative AI) feature, agents can quickly view the critical information (summary) about the different activities in the timelines, without the need for clicking/reading through each of the activities.

We can enable and disable it at both the form level, app level and environment level.

At the form level, we can check/uncheck the Enable Timeline Highlights checkbox for the timeline component.

A screenshot of a computer

Description automatically generated
A screenshot of a computer screen

Description automatically generated

At the App level, open the Settings >> Features for the corresponding App.

A screenshot of a computer

Description automatically generated

Here if we disable it at the App-level it won’t show up even if it is enabled for that particular form for that particular app.

For e.g. we see timeline highlights in the Sales Hub App but not in the Field Service app in which we had it disabled for the account form.

We can also specify it using the Setting Definitions and Environment values as shown below.

A screenshot of a computer

Description automatically generated

More details –

Use timeline highlights powered by generative AI

Timeline highlights help users quickly access actionable record updates

Hope it helps..

This password does not meet the length, complexity, age, or history requirements of your corporate password policy (Minimum Password Age)


We might get the below error even after specifying a new password having the appropriate length, complexity, age, etc.

If you are also facing the same, it could be because of the Minimum password age policy setting. It specifies the duration for which the password must be used before it can be changed. It could be a value between 1 and 998 days, also it can be set as 0, which means the password cannot be changed again immediately.

A screenshot of a computer error

Description automatically generated

In our case also, we had changed the password and within a few minutes we again wanted to change it for some testing, that is where we got that issue. Finally, after 24 hours, we were able to do so.

The below article explains in detail about different Password Requirements and how they apply in the case of Azure AD.

https://www.linkedin.com/pulse/what-active-directory-azure-ad-password-requirements-valentin/

Hope it helps..

Advertisements

This operation cannot be performed because there is an active lifecycle operation on the environment – Dataverse / Power Platform


While trying to enable Admin Mode for one of our Dataverse Environments,

we got the below error

“This operation cannot be performed because there is an active lifecycle operation on the environment”

A close-up of a message

Description automatically generated

This was because we had a copy operation going in the background, we were copying that particular environment to another environment.

After the copy operation was completed (around 1 hour, for the environment DB Usage – 45 GB, File Usage – 118 GB, and Log Usage – 21.63 GB), we were able to switch on the Admin mode.

Hope it helps..

Advertisements