Use case for invoke code in uipath studio

Hi,

Is there any specific use case which can only be automated by writing Vb or C# code in invoke code activity?
Even if I write c# code for automation in studio, I feel it can be achieved via activities also or using Assign and write a part of code in it (like linq) .I believe Its just that using invoke code, makes code cleaner as number of activities reduces. Is there any reason why people would prefer invoke code and not use activities for automation?

Hi @garimavarshney9

  1. Complex Logic: If you have complex logic or algorithms that are not easily achievable using the available activities or expressions, writing custom code in Invoke Code can provide more flexibility and control. You can leverage the full power of programming languages like VB.NET or C# to handle intricate business rules or calculations.
  2. Performance Optimization: In some cases, writing custom code can offer performance benefits compared to using a large number of activities or expressions. If you need to process a large amount of data or perform complex computations, writing optimized code in Invoke Code can improve the efficiency of your automation.
  3. Custom Integration: If you need to integrate with external systems or libraries that require specific code snippets or custom functions, Invoke Code allows you to directly use the required code in your workflow. This can be useful when working with specialized APIs, databases, or other third-party tools.
  4. Code Reusability: Invoke Code allows you to encapsulate reusable code snippets or custom functions that can be easily invoked from multiple places within your workflow. This promotes code modularity and reduces redundancy, making your automation more maintainable.
  5. Development Experience: For developers or individuals with programming backgrounds, using Invoke Code may provide a more familiar and comfortable development experience. It allows them to leverage their existing coding skills and techniques within the UiPath environment.

Regards!

1 Like

Can you give me some real time example of such complex logic or algorithm

@garimavarshney9

Few examples where activities are not available and we have to use invoke code

  1. Embed a document into excel
  2. Read pdf form fields
  3. Get outlook folders
  4. Paste the data from excel to word with formatting

There are many more examples…these are just few where activities are not available and we use invoke code

Hope this helps

Cheers

1 Like