studio
2023.10
false
UiPath logo, featuring letters U and I in white
Studio User Guide
Last updated Nov 18, 2024

Invoking Coded automation in another Coded automation

This tutorial shows you how to invoke a coded automation within another coded automation. We demonstrate this by using a sample scenario where a coded workflow invokes the CodedResetAssetValue coded automation. The CodedResetAssetValue automation retrieves the values of an asset, compares them to an input value, and updates the asset in Orchestrator if the values are different. If the values are the same, it logs a message that the asset value remains unchanged.
  1. Use the RunWorkflow method to invoke the CodedResetAssetValue.cs file, and provide Dictionary <string, object> pairs as arguments.
    In the dictionary, specify the values for the assetName and assetValue parameters.
    For example, set assetName as "MyAsset" and assetValue as "hello world".
    Assign the result from the method to a variable named result.
    var result = RunWorkflow("BusinessProcess\\CodedResetAssetValue.cs", new Dictionary<string, object>()
          {
            {"assetName", "MyAsset"},
            {"assetValue", "hello world"}
          });var result = RunWorkflow("BusinessProcess\\CodedResetAssetValue.cs", new Dictionary<string, object>()
          {
            {"assetName", "MyAsset"},
            {"assetValue", "hello world"}
          });
  2. Use an if-else statement to check if assetValueWasChanged is true.
    • If assetValueWasChanged is true, log a message that indicates the asset was reset and include the previous value it had.
    • If it is false, log a message specifying that no reset was required on the asset because it had the expected value.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.