How to get asset inside “Invoke code” activity?

Hi,

I use this approch to get an asset with an InvokeCode activity :

Dim v_asset As UiPath.Core.Activities.GetRobotAsset = New UiPath.Core.Activities.GetRobotAsset()
v_asset.AssetName = "ASSETNAME"
Dim activity As WorkflowInvoker = New WorkflowInvoker(v_asset)
a_result = activity.Invoke()

However, It occurs this error : Orchestrator information is not available. Please check if UiPath Robot Service is started.

My machine is connected on Orchestrator and I have not problem to use a Get Asset activity directely in a Flowchart/Sequence.

Do you know why the invoke code loses the connectivity with UiRobot/Orchestrator ?
Is there a line of VBNET code missing in the InvokeCode ?

Thanks !
Paul

1 Like

Hello @PaulCeriaOiseauRare

I suggest that you use arguments.

Hope that helps :upside_down_face: