Getting Nested Keys values from dictionary in Uipath

Hi All,

I’m using Get Credential activity to get the credential details from the orchestrator. This is working fine.

Asset Name: HR_Credential
Storing the Password in Password variable
Storing the Username in Username variable

There are many more credentials defined in the orchestrator for different access

My Problem statement :- I need to used a dictionary to fetch values for all different credentials in the below mentioned fashion
HR_Credential.Username.value
HR_Credential.Password.value

Any kind of guidance would be helpful…

Trying to understand your intention behind this problem statement. Is it to reduce the numerous variables that you are assigning the username and password to?

Hi,

I’m not sure on this… it might be the reason. I’m following the instructions which was given to me to build up in this way. Any sort of insights would be helpful.

Thank you

Well I guess if you are using too many credentials within the same process flow, you can create a separate workflow to get all the credentials you need from the orchestrator and carry them around as dictionaries rather than variables.

Your Get All Credentials workflow should be like :

  • Define a dictionary variable - dictUsernames (Key - String, Value - String)
  • Define a dictionary variable - dictPasswords (Key - String, Value - SecureString)
  • Define an String array variable - arrCredentialNames with all the credentialNames to be retrieved from orchestrator

For each name in arrCredentialNames

  • Get Credential - Get the credential using the name from orchestrator
  • Assign dictUsernames(name) = username retrieved
  • Assign dictPasswords(name) = password retrieved

Once the workflow is executed then you can retrieve the credentials from these two dictionaries.
Say the name of the credentials saved in orchestrator was “HRAdmin”
username would be dictUsernames(HRAdmin)
password would be dictPasswords(HRAdmin)

Hope this helps.

1 Like

Thanks a lot for the detailed explanation. It really helped :slight_smile:

2 Likes

My pleasure! :slightly_smiling_face:

1 Like