Creating a Workflow Activity Library and Activity Part 3
Published Nov 01 2019 02:36 PM 592 Views
Microsoft

First published on MSDN on May 17, 2016
This post is in continuation of the Post Creating a Workflow Activity Library and Activity Part 2 This post will focus on Defining properties for your custom activity.
Now, you can define properties that will store the log file path and log file name where the activity will log information about the current request and workflow dictionary information.
The following table describes the three properties that you add for the RequestLoggingActivity.

Property name Description
LogFilePath This property is an input property indicating the folder where the log file should be saved.
LogFileName This property is an input property indicating the log file name.
CurrentRequest This property is used to store information about the current request.


The input properties will be displayed in the Workflow Designer in the FIM Portal when the activity is added to a workflow. The user that adds the activity to the workflow must enter values for these properties.

To define properties for the RequestLoggingActivity


(Locate the Solution Explorer, if for some reason it was closed you can always reopen it in from the View Menu)
Right-click RequestLoggingActivity.cs in Solution Explorer , and then click View Code .



You should now see the code as it is represented so far.

Add the following using statements to the top of the file:





using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
//The following two namespaces define the FIM object model
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
using Microsoft.ResourceManagement.Workflow.Activities;


The code should now look something like

Add the following code to RequestLoggingActivity.cs after the class constructor:





#region Public Workflow Properties
public static DependencyProperty ReadCurrentRequestActivity_CurrentRequestProperty = DependencyProperty.Register("ReadCurrentRequestActivity_CurrentRequest", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType), typeof(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity));
/// <summary>
/// Stores information about the current request
/// </summary>
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Misc")]
public RequestType ReadCurrentRequestActivity_CurrentRequest
{
get
{
return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType) (base.GetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty)));
}
set
{ base.SetValue(FIM.CustomWorkflowActivitiesLibrary.Activities.RequestLoggingActivity.ReadCurrentRequestActivity_CurrentRequestProperty, value);
}
}
/// <summary>
/// Identifies the Log File Path
/// </summary>
public static DependencyProperty LogFilePathProperty = DependencyProperty.Register("LogFilePath", typeof(System.String), typeof(RequestLoggingActivity));
[Description("Please specify the Log File Path")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
public string LogFilePath
{
get
{
return ((String)(base.GetValue(RequestLoggingActivity.LogFilePathProperty)));
}
set
{
base.SetValue(RequestLoggingActivity.LogFilePathProperty, value);
}
}
/// <summary>
/// Identifies the Log File Name
/// </summary>
public static DependencyProperty LogFileNameProperty = DependencyProperty.Register("LogFileName",
typeof(System.String), typeof(RequestLoggingActivity));
[Description("Please specify the Log File Path")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
public string LogFileName
{
get
{
return ((String)(base.GetValue(RequestLoggingActivity.LogFileNameProperty)));
}
set
{
base.SetValue(RequestLoggingActivity.LogFileNameProperty, value);
}
}
#endregion
You have now defined three properties that you can use in your custom activity.

 

Version history
Last update:
‎Feb 20 2020 01:07 PM
Updated by: