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.
- Use the
RunWorkflowmethod to invoke theCodedResetAssetValue.csfile, and provideDictionary <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"}
});
- Use an if-else statement to check if
assetValueWasChangedis true.- If
assetValueWasChangedis 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.
- If