You are viewing limited content. For full access, please sign in.

Question

Question

Workflow to removed a specific value from a multi-value field.

asked on August 20, 2021

We are trying to create a Workflow to remove an unwanted field value from around 6200 items in the repository. Any suggestions on what activity I can use to simply remove that value. My mind is telling me the assign field values activity wont work because I will effectively need to remove the field and then re-add it. Between the 6200 there is not an consistent sequence for value I want removed. 

Here is an example of what the template looks like:

0 0

Answer

SELECTED ANSWER
replied on August 20, 2021

You should actually be able to do this without looping through the individual values by utilizing the Remove function in the token editor.

If your target text is always the same (list order doesn't matter) then you can:

  1. Use Retrieve Field Values to get ALL of the values
  2. Use Assign Field Values
    1. Select the same field
    2. Set it to REPLACE existing values
    3. Set the value from the Retrieve Field Values activity
    4. Right-click and open the Token Editor
    5. Check Apply Function
    6. Click Select Function
    7. Choose "Remove" (not remove at)
    8. Enter the text for your target value

 

No looping the values or conditional sequences required.

 

If you want to be safe, you could create a separate multivalue token to hold the edited list, then assign that list to your document field. At the very least, you may want to do that for your initial tests so you can see how the Remove function is working without having to update a document.

 

A couple of other notes:

  1. You need to use Retrieve Field Values because although you can get fields as part of the search, it will not return multivalue tokens for multivalue fields.
  2. I highly recommend doing this in batches. When you get above 200 or 300 loops the instance data really starts to accumulate and bog down the workflow's execution time, meaning it might start at 1 second per document, but end up taking 2 mins or more per document by the time you get to document 5,000
3 0
replied on August 20, 2021

Thanks Jason this worked to perfection. 

0 0

Replies

replied on August 20, 2021

Hi Lawrence,

Something to try here could be creating a workflow that searches for each entry in question, and then for each entry, retrieves the multi-value field in question, and writes those values to a new multi-value token ONLY IF the value doesn't equal "Attendance Card Agreement." Then, you can use that multi-value token to assign field values to the same document. 

Your workflow could look something like this:

 

Let me know if I can clarify anything or if I'm not quite understanding your situation.

1 0
replied on August 20, 2021 Show version history

You may need to put the Conditional Sequence within a For Each Value loop, with the For Each Value activity looping through each value of the multi-value field, and only adding the value to the multi-value token if the value DOES NOT EQUAL "Attendance Card Agreement."

Might look like this:

1 0
replied on August 20, 2021

Thank you Jacob for taking time out your day to provide a possible solution.

 

0 0
replied on August 23, 2021

No worries. I wish I would have made a post similar to yours a few months ago when I did something similar. Jason's solution would have saved me a little time than doing it the way I described here!

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.