How to get item from dictionary

Hi,
I am using the Split String workflow action. The dictionary comes in a [“a”,“b”,“c”] format. How do I specify the path to the items?
Thanks!

Hi Elizabeth,

Please read this article to understand how to work with split workflow action. See ‘How to use workflow actions’ section.

The key to get item from dictionary will look like this ({Variable:Index}), where Variable:Index is an index in the loop. The picture below shows how to enumerate through dictionary:

Thanks a lot!

You are welcome!

Hi Roman,
I am trying use split string from Plumsail and followed the steps that you mentioned in your post.
“Get Item from dictionary by Index” is not supported in SharePoint designer 2013. I get an error when I try to use this in my workflow as suggested in your post. Is there any work around that?

Hello,

Please make a screenshot of the configured workflow action and a string that you are trying to split.
You can post it here or email us to [email protected]

Did you find the answer to the last follow-up question on this post?
I think I might have hit upon something similar.
Using Action Pack to read people in a given access group into a Dictionary variable.
Using your guidelines for reading it out again
Ex of failing statement: Get [%Variable: index%] from Variable: Dictionary (result to Variable: person )

But execution fails with message:
System.InvalidOperationException: Looking up a value using a key is not supported on an instance of ‘Microsoft.Activities.Dynamic.DynamicJsonArray’. at Microsoft.Activities.Dynamic.DynamicItem.TryGetValue(String key, DynamicItem& value) at Microsoft.Activities.Dynamic.DynamicValueBuilder.PathSegmentFactory.ObjectPathSegment.Get(DynamicItem obj) at Microsoft.Activities.GetDynamicValueProperty1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hi Geir,

I would recommend you to use send email to see the whole object of your dictionary.
Also as I know if you’re trying to get value from array you have to use brackets.
Example: Get ([%Variable: index%]) from Variable: Dictionary (result to Variable: person )

Thanks for responding, Roman.
Tried to include parenthesis. This gives a different error message:
System.InvalidCastException: The value ‘(0)’ cannot be read as type ‘String’. at Microsoft.Activities.GetDynamicValueProperty1.CheckedRead(String propertyName, DynamicItem value) at Microsoft.Activities.GetDynamicValueProperty1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

This is the key statements in my WF:
Get members of SharePoint group Variable: WF_GruppeMedl and save to Variable: Dictionary
Telle elementer i Variable: Dictionary (utdata til Variable: antall ) (= count )
Sett Variable: index til 0
LOOP antall TIMES
Get ([%Variable: index%]) fra Variable: Dictionary (utdata til Variable: person )
[Get variable. person=String, index=whole number)
Beregn Variable: index pluss 1 (utdata til Variable: kalk )
Sett Variable: index til Variable: kalk

Any obvious errors here?
This is executing in an 2013 List WF. Any issues here?

Geir,

I can’t say exactly where the error because I can’t see the JSON value in your Dictionary.
If you want we can setup screen sharing session to fix the error, please write us to [email protected].

Hi

first i would to tks plumsail because you provide you plug in for sharepoint.
Now i try it some 30 month, and i want to use dictionary

so i copy the previous process to do this:
i have file with complete informations on name ex : AC1111212-FOURNISSEUR-MACHIN-PRICE.pdf

so i use Split to extract each element separated per - but it’s not work.
i copy the enumerate trought dictionary but i have an error on sharepoint

Looking up … a value as a key etc…

and How i can get first item to get item ?

Tks advance

[quote=“ehermouet”]Hi

first i would to tks plumsail because you provide you plug in for sharepoint.
Now i try it some 30 month, and i want to use dictionary

so i copy the previous process to do this:
i have file with complete informations on name ex : AC1111212-FOURNISSEUR-MACHIN-PRICE.pdf

so i use Split to extract each element separated per - but it’s not work.
i copy the enumerate trought dictionary but i have an error on sharepoint

Looking up … a value as a key etc…

and How i can get first item to get item ?

Tks advance[/quote]

Please see example below:




Tks for reply

but i can’t set my file name in variable because my file name change all time.

I will explain that i want.

I use powershell to auto (task) import file into directory on sharepoint.
when my file is in directory i want to use workflow to do something -> Name field, add task to user etc…

i found.
my problem come from Log history

tks

ehermouet

Thanks for sharing your solution