Use Invoke code which task may not able to do by using activities

Hi community, Can anyone give me one real-time example/scenario that requires invoke code activity because which is not possible by using activities.

Thank you in advance.

Hi @Shankar_MasRobo

“Invoke Code” activity allows you to write custom VB.NET or C# code directly within your workflow. This is particularly useful when you encounter a scenario that cannot be easily handled by the standard activities provided by UiPath.

Check the below documentation and there is an example provided at the end of documentation.

Hope it helps!!

1 Like

A good example is building a JSON object, adding properties to it etc.

This could be done with a series of Assigns but it’s much simpler to just to it in Invoke Code.

2 Likes

Here is another example,

My bot receives emails with Supplier details on the email body, users often make mistakes and misspell words/labels I use as anchors, and the bot uses regex to find information e.g., VAT Number, a user might just use VAT or VAT no. To get around the possible variance, I needed to build a dictionary containing possible ways users might misspell each of the labels and perform an auto-correct before trying to find information using regex.

It took me less than 5 minutes to build this code, I just had to prompt ChatGPT to write me the code and I copied and pasted it into Studio, this would be a lot more complicated to do using the UiPath activities. I would have had to build the dictionary within an assign activity and I know you do not want to imagine what that would look like lol.

1 Like

@Shankar_MasRobo

A simple one would be say you need to embed a file into excel…for which you dont have an activity uou can use invoke code

Cheers

1 Like

Hi, Thank you for your response, in that UiPath’s example, it will be simply achieved by one or two UiPath activities.

My requirement is which we cannot do by activities or more complex with activities,
So, in this case need to use Invoke code activity. Like that scenario is my requirement.

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