Tuesday, February 21, 2023

Sample code to create custom workflow in dynamics 365 crm CE

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
 
namespace Carl.CustomWorkflowAction1
{
    public class SetStateToNY : CodeActivity
    {
        [RequiredArgument]
        [Input("String input")]
        public InArgument<string> CityInput { get; set; }
 
        [Output("String output")]
        public OutArgument<string> StateOutput { get; set; }
 
        protected override void Execute(CodeActivityContext context)
        {
            string city = CityInput.Get(context);
            if (city == "NYC")
                StateOutput.Set(context, "New York");
            else
                StateOutput.Set(context, string.Empty);
        }
    }
}

No comments:

Post a Comment

How to Deploy your API as a web app or API app

  Before you can call your custom API from a logic app workflow, deploy your API as a web app or API app to Azure App Service. To make your ...