Get the key Values From Transaction item

Hello
HOw to get the Key Form a transaction and use it as a string ?


I want to get These Keys and Store it in a string Value
ow Can i Do that ?

Hi @Karam_Abulawii,

You want the values for given keys in in_TransactionItem.SpecificContent.
You can use assign or multi-assign activity
YourVariableForFirstName = in_TransactionItem.SpecificContent("FirstName").ToString
YourVariableForLastName = in_TransactionItem.SpecificContent("LastName").ToString
and further.

This question is quite similar to the ones asked here :slight_smile:

1 Like

Thanks For the Response
but i’m trying to get “FirstName” , “LastName” , “Phone” , …etc
in a Variable not the Specific Content

Hi @Karam_Abulawii,

Then you just use the keys from the dictionary.

FirstSevenKeys = string.Join(", ", in_TransactionItem.SpecificContent.Keys.ToArray.Take(7))

string.Join joins the array values with ", " as seperator (a single space after comma to make the output pretty)
in_TransactionItem.SpecificContent.Keys gets you all the keys in the specific content
in_TransactionItem.SpecificContent.Keys.ToArray converts dictionary keys to an array
in_TransactionItem.SpecificContent.Keys.ToArray.Take(7) slices the array to only get you the first 7 keys as you requested

Log Message : FirstSevenKeys should return what you are looking for.

5 Likes

Thank You
But what is the Type of “FirstSevenKeys” ?

FirstSevenKeys will end up being a string type. This happens because of String.Join.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.