web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Unable to activate the business rule via C# SDK

(1) ShareShare
ReportReport
Posted on by
Hi, 
 
Am trying to clone business rules from quote entity to custom entity using C# SDK.
I have successfully clone the business rules but I couldn't able to activate the business rule using C#.
Its getting update same  definition row itself. its not creating sperate row for activate business rule so that business rule is not visible in powerapps. 
 
I have attached the code snippet below:
 
But its working fine for workflow(process). 

private void ActivateWorkflow(IOrganizationService organizationService, Guid _workflowId)
{
    var activateRequest = new SetStateRequest
    {
        EntityMoniker = new EntityReference
                    (Workflow.EntityLogicalName, _workflowId),
        State = new OptionSetValue((int)WorkflowState.Activated),
        Status = new OptionSetValue((int)workflow_statuscode.Activated)
    };
    organizationService.Execute(activateRequest);
}
I have the same question (0)
  • sandeep-r Profile Picture
    on at
    Unlike workflows, Business Rules require ActivateProcessRequest (not SetStateRequest) to activate them in Dynamics 365 using C#. This creates a separate published definition row in the database, making the rule visible and active in PowerApps.
    organizationService.Execute(new ActivateProcessRequest { ProcessId = clonedBusinessRuleId });
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans