How to add a Check box for a property in Custom Activity?

I’m working on a custom activity where I want to deal with some boolean properties.

Now those boolean properties are also being displayed as a normal text field(like string related properties). I wanted to add a toggle /check box in place of a text area.

Attached a boolean property, FYR…

image

P.S. [Category("Options")] property is not making any change.

1 Like

Hello @ManiPrajwal_K ,

This will help you,

1 Like

Hi @Pradeep_Shiv no luck… and I cannot even open his activity…

@loginerror @Pablito Can anyone please help me…!

Hi @ManiPrajwal_K

Could you please mock-up how you want this to look like? Could you maybe mock-up your requirement, I’m not sure I understand :slight_smile:

Is it something like this?
image

Thanks, @loginerror for your response.

This is how my custom activity’s boolean property should look like
image

I need to change the input approach of a boolean property from typing to toggling the checkbox, just like above-shown picture.

Although I’m not sure about the answer, I think you could go over the code of our Open Source FTP activity which has such a checkbox:

You can find the code of this activity here:

Yes @loginerror … I’ve followed the same approach in code but after publishing and using the activity in UiPath, this is how it is appearing. I want a check/toggle box instead of a normal text field.

@ManiPrajwal_K can you please share a bit of your code which declares the property?

Do you want a static property (i.e. a property which you can set through a checkbox at design time)? Do you want an InArgument (i.e. a property which can take a variable or other expression and resolve it at runtime)?

Hi, @Tudor_Sandu thanks for the response. Sorry, I cannot share any snippet related to my organization. Just to give a glance, I have declared my property as a Boolean datatype.

Then I need a Static one. Which can set through a Check box while designing the workflow.
Eg:
I need to add a checkbox beside the Display property.

Previously I’ve used [Category("Options")] for a boolean property, now it is not working. I’m not sure why!

Hi please refer this post

1 Like

TL;DR

public bool Bool_property { get; set; }
public Boolean Boolean_property { get; set; }

both of these should produce a checkbox in the property panel.

If it still doesn’t work for you, we need to see some code to debug.

This is how I declared my property:
public InArgument<bool> Display { get; set; }

Yes, and you have to declare it as bool instead of InArgument<bool> if you want it to look like in your screenshots above.

image
Thanks, @Tudor_Sandu for the suggestion, but if I try to change it I’m getting the attached error!

The above show Get method was a code generated by the Activity creator.

Can you try “var display = Display;” ?

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.