Get Credential activity in a For each loop

How inefficient would it be if get credential/asset activity is used within a for each loop, any thoughts ?

1 Like

Hi!
If you have a changing part in your asset name (eg. myAsset + x.tosting()) and want to get them from Orchestrator it is possible. However in my opinion if it is not required to be in Orchestrator (like in case of credentials) then it would be more efficient to use an Excel table to read the desired values. In this case it would be more easy to create and modify than Orchestrator assets one by one.

2 Likes

Without knowing more about your use case it is hard to say how inefficient it would be. Are they already stored as assets in Orchestrator? Do you already have a list of the assets to iterate through using the for each loop? I don’t think it would be considered inefficient from a robot processing perspective but it might be from a setup and ongoing maintenance perspective if you had lots of updates that needed to be performed on the assets. Although, I suppose you could create a robot process to perform those updates. In the end, it really depends on what you are actually trying to accomplish in order to determine the efficiency of the process being performed in my opinion.

2 Likes

Yeah, depends on what you are wanting to do.
If for example you want to loop through multiple credentials to process items for each set of credentials, then I don’t see how it would be a problem to be honest.

Let’s say you have 3 assets that you need to process, you could send an array to your foreach loop:

in_CredArray = {"App.Cred1","App.Cred2","App.Cred3"}

For each cred In in_CredArray
   Get Asset Credential for cred
   <process actions>
2 Likes

Yeah it makes sense to use getCredential only once as we do not have any part of the credential which would change during the execution.

1 Like

Agree

1 Like