I need to add a drop down list as an “in_argument” to a custom library. However, I want to build this as a template to add any number of text values for different situations. Sometimes I might have 2 values, sometimes 3 depending on the workflow. The values may also be different but I could (potentially) enter those into the invoked workflow in_argument setup.
I have seen many posts related to this question and all point to either the Activity Creator or Nuget Package Manger.
Is one more acceptable/reliable/supported than the other? Activity Creator seems easier to set up but also seems to bring a lot of overhead.
While the demos are somewhat helpful in understanding, can somebody walk me through the process and code required to actually build the drop down list? I have some c# experience, but not so much with all the class and enum structures.
At least, Nuget package manager is for just nupkg. So you cannot create or edit your code for activity in it.
Activity creator is visual studio extension to make custom activity easier. We can create custom activity without it. However it provides various function such as Wizard, template of scope activity etc. I recommend you to use it.
While the demos are somewhat helpful in understanding, can somebody walk me through the process and code required to actually build the drop down list? I have some c# experience, but not so much with all the class and enum structures.
If you want to make static dropdown, define your enum type, then write arugument definition as the following.
enum YourEnum
{
A,
B
}
public YourEnum YourPropertyName { get; set; }
Or
In ActivityCreator, we can make it to set None at Direction and your enum type at Type in DefineProperties of Wizard.
Thank you for the clarification. I will use the Activity Creator - after what you say, it makes sense to me.
I have done what you said in the Wizard. Is there anything required in the code? or do I just package and publish? I would like to define the items when I use the type in the in_argument (maybe in the default field?) but if that is not possible I could create a new version for each list? Sorry for the step-by-step, I just want to learn to do this the correct way. The raw code is below - have not added anything except from the wizard.
namespace UGIES.RPAextensions.Activities
{
[LocalizedDisplayName(nameof(Resources.EnumDropDown_DisplayName))]
[LocalizedDescription(nameof(Resources.EnumDropDown_Description))]
public class EnumDropDown : ContinuableAsyncCodeActivity
{
#region Properties
/// <summary>
/// If set, continue executing the remaining activities even if the current activity has failed.
/// </summary>
[LocalizedCategory(nameof(Resources.Common_Category))]
[LocalizedDisplayName(nameof(Resources.ContinueOnError_DisplayName))]
[LocalizedDescription(nameof(Resources.ContinueOnError_Description))]
public override InArgument<bool> ContinueOnError { get; set; }
[LocalizedDisplayName(nameof(Resources.EnumDropDown_EnumDropDown_DisplayName))]
[LocalizedDescription(nameof(Resources.EnumDropDown_EnumDropDown_Description))]
[LocalizedCategory(nameof(Resources.Input_Category))]
public Enum DropDownList { get; set; }
#endregion
#region Constructors
public EnumDropDown()
{
}
#endregion
#region Protected Methods
protected override void CacheMetadata(CodeActivityMetadata metadata)
{
base.CacheMetadata(metadata);
}
protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
{
// Inputs
///////////////////////////
// Add execution logic HERE
///////////////////////////
// Outputs
return (ctx) => {
};
}
#endregion
}
}
I apparently am missing something. I selected as you said (SearchOption) and packaged. I imported to to my uipath workflow and selected it. But I am not sure what to put in “Enter a VB expression”??