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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Set InData OutData in Action

(0) ShareShare
ReportReport
Posted on by 6,211

Hi All,

I have created Global Action and also i have set indata and outdata type, but when i click set properties button show in below screenshot, it open window for setting values for Indata, but here it is showing blank, can anyone tell me what is wrong.

1373.Action.PNG

Best Regards,

Shahbaaz

*This post is locked for comments

I have the same question (0)
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Shahbaz,

    Have you set the input/ output parameter on you custom workflow activity? Is this a new custom workflow activity or you have it already and later add the input/output parameter?

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    Yes i have set, below is my full code

    using Microsoft.Xrm.Sdk.Query;

    using System.Activities;

    using Microsoft.Xrm.Sdk.Workflow;

    using Microsoft.Xrm.Sdk;

    using System;

    //using Microsoft.Crm.Sdk.Messages;

    namespace Workflow_Activity

    {

       public class LeadAssignment : CodeActivity

       {

           // Declare input/output variable of string type and declare it’s property like below

           [Input("Topic")]        

           public InArgument<string> Topic { get; set; }

           [Output("Day of Week")]

           public OutArgument<String> DayofWeek { get; set; }

           protected override void Execute(CodeActivityContext Execution)

           {

               string Day = "Test";

               DateTime _Date = DateTime.MinValue;

               //get context

               IWorkflowContext context = Execution.GetExtension<IWorkflowContext>();

               ITracingService tracing = Execution.GetExtension<ITracingService>();

               tracing.Trace("1");

               //create iorganization service object

               IOrganizationServiceFactory serviceFactory = Execution.GetExtension<IOrganizationServiceFactory>();

               IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

               //get created date of the lead

               Entity _lead = (Entity)service.Retrieve("lead", context.PrimaryEntityId, new ColumnSet(new string[] { "createdon" }));

               if (_lead.Contains("createdon"))

               {

                   //get day of the week based on created on date

                   Day = ((DateTime)_lead.Attributes["createdon"]).DayOfWeek.ToString();

               }

               //set value to output variable

               DayofWeek.Set(Execution, Day);

               //new_createdday

               tracing.Trace("completed execution");

           }

       }

    }

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    and also how can we set the OutData from the custom workflow activity to action.

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Could you please confirm if you had the the parameters before you register the assembly in crm or you resister the assembly in CRM and then changed the assembly to add parameter and register the assembly again.

    There are few things to consider when you register the assembly.

    Take a look on this thread- community.dynamics.com/.../261109

    Hope this helps.

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    input parameter i added later after registering assemblies, but after adding inData in custom workflow activity i updated the dll.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    If you have added the parameters later then it won't be visible until you unregister and register it again.  If you have dependency for this assembly then need to change the major version of the assembly and register the assembly again which will then appear as version 2 with the parameters.

    Also, you set the output parameter of custom action when you actually execute the action. The screenshot you have shared is to create the custom action.

    Hope this helps.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Take a look on the thread I have shared above

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    Thank you very much Ravi, it worked.

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Ravi,

    Please could you also help me in, i have set the input parameter but from where it will take the actual value?

    Best regards,

    Shahbaaz

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Shahbaz,

    Could you please share more details what exactly you are looking for?

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans