Studio credential object (variable) instantiation in Assign activity (how to)

How instantiate an UiPath.OrchestratorClient.Utilities.Credential type variable (object) in an Assign activity?

I want to add a credential object to a Dictionary (key,value list). I am getting the credential from an Orchestrator Asset. I think I need to create a variable of type credential with the orchestrator asset value (which I successfully got) and after add this object to the Dictionary variable (no problem with this) but I am having trouble with the VB sintaxe creating the variable(object) of type UiPath.OrchestratorClient.Utilities.Credential (the type I think I need due I am getting it from Orchestrator).
Thanks for reading!

You can use the “GetCrendential” activity which gets the credentials from the Asset and store the User name and Password in separate variables.

User name is of type String
Passwords are stored in a variable of type SecureString.

Create the dictioanry of type Key,Object


Dictionary (left side) newDictionary(of String, Object) right side.
Add values to dictionary (with the UserName and password variables obtained from Getcredential)

Hope this helps.

Thanks but I am afraid I wasn’t clear. The access of the credential is not a problem for me, as well as adding values to the Dictionary. What I want
to add though is an object of type credential (so I need the syntax to instantiate one).

It is working!

to create a orchestrator Credential object (Assign activity):
demoCredential ← New UiPath.OrchestratorClient.Utilities.Credential()

to get the credential from the Orchestrator use GetCredential activity

to populate the Credential object (Assign activity):
demoCredential.Password ← GetCredential Out property Password
demoCredential.Username ← GetCredential Out property Username

to add it in a dictionary named out_Config (Assign activity):
out_Config.item(“UIDemoCredential”) ← demoCredential

to recover the credential object further on (Assign activity):
credentialObject <–DirectCast(in_Config.item(“UIDemoCredentials”),UIPAth.OrchestratorClient.Utilities.Credential)

where “UIDemoCredentials” is a Dictionary key used for this object.