Custom Activity parameters and spaces in names

Using visual studio I have created a custom activity.
I have worked out that the class name equates to the activity name and that the folder structure is defined by the namespaces.

How do I put spaces in the activity name as you can’t have a class with a space in it?
How do I put spaces in the activity folder as you can’t have spaces in a namespace?

How do I add hover over tooltip type messages for activity parameters?

How do I create a drop-down parameter for an activity to allow the user to select an option?

2 Likes

Any clear answers on these questions?

Underscores will come out as spaces when loaded into UiPath so

  • my_custom_activitiy will load as ‘my custom activity’ in UiPath
  • if the namespace is My_Activities it will be in the folder ‘My Activities’ in UiPath

For the tool-tip you create a Designer with metadata linking the activity to a Ui Design and add a description in there.

1 Like

Thanks @ConorSmalley for the answers,

For the first two I figured it’s gonna be either Underscores or Capital letters so my_custom_Activity or myCustomActivity, you will have the same result,

But still for hover I add a description in the nuget package explorer, but this doesn’t show anything while hovering in studio, where can I create a designer with metadata is it going to be in visual studio itself?

And last for the drop down should the property be of an option type to achieve this?
These are some important questions that should be answered in the forum but somehow they’re not!

For the description you want a couple of files adding to your project which I’ve given an outline of below. There is a lot of examples on some of the Microsoft Forums/Blogs if you search for ‘Custom WPF Activities’ which is essentially what UiPath Activities are.

  • myActivity_Designer.xaml
    this is where you design the XAML layout of the activity and you need the line below at the top to link the designer.xaml, designer.xaml.cs and the MetaData.cs

    <sap:ActivityDesigner x:Class="NAMESPACE.myActivity_Designer">
    
  • myActivity_Designer.xaml.cs
    this is where you add the description

    public partial class myActivity_Designer
    {
      public myActivity_Designer()
      {
          InitializeComponent();
      }
    
      public static void RegisterMetadata(AttributeTableBuilder builder)
      {
          builder.AddCustomAttributes(
              typeof(myActivity),
              new DesignerAttribute(typeof(myActivity_Designer)),
              new DescriptionAttribute("MY DESCRIPTION.")
              );
    
      }
    }
    
  • myActivity_MetaData.cs

    public sealed class myActivity_MetaData : IRegisterMetadata
    {
      public void Register()
      {
          RegisterAll();
      }
    
      public static void RegisterAll()
      {
          var builder = new AttributeTableBuilder();
          myActivity_Designer.RegisterMetadata(builder);
          // TODO: Other activities can be added here
          MetadataStore.AddAttributeTable(builder.CreateTable());
      }
    }
    
1 Like

Update on Combo Box

Within the designer you can specify a Combo Box (see link below) which links in to the properties panel.

This post shows how you can use an enum to populate a combobox in the properties

You can easily update the way the activity name is displayed updating the DisplayName property of the class in its constructor:

image

FYI, I’ve created this Visual Studio Item Template to help with the custom activity creation and it auto-generates these methods for you so you don’t need to memorize it.