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

Discussion

Discussion

Frustrated with Group Fields in workflow

posted on January 13, 2021

Hello Everyone,

I have spent the better part of the day dealing with updating and managing Group Fields via Workflow and I'm exhausted. I already have one workflow that can change a value with a script based on an answer post I found. Not the best way but it works. the issue today was the fact that A user can add a group field and because I can't use default values in these (tried and anytime workflow added one values, it would mess up the order and just made it worse, so I apply values for all fields myself in a workflow to ensure the groups are correct) a user will leave some values blank. If you have blank values in a group field, the SDK script that grabs the collection fails with an error. 

I found this post, https://answers.laserfiche.com/questions/127695/workflow-assign-field-value-add-null-fields-to-field-group#127740 and Miruna suggests rebuilding multivalue tokens and then applying the all once to get the groups to be correct. Well, most of the day was dedicated to building a workflow to identify when there are blank values and then trying to add default values to the correct location without changing the existing values. 

Anyway, I guess this is turning into a feature request. We NEED a native Workflow activity that can interact with these values based on their index locations. Something that I could easily append values to certain groups based on the value of an index number. 

0 0
replied on September 1, 2022

Hello Lucas --

We have a similar use case ... we need to know if there is a blank value in our GL Account, GL Amount or GL Cost Center fields.

I've built a test workflow from your screenshots, following are my activities:

1.  Retrieve field Values:  GL_Account, GL_Amount, GL_Cost_Center

2.  For Each Value:  %(RetrieveFieldValues_GL_Account_All), %(RetrieveFieldValues_GL_Amount), %(RetrieveFieldValues_GL_Cost_Center)

3.  Conditional Sequence:  Starting Entry:  Field (GL_Account) is empty, Starting Entry:  Field (GL_Amount) is empty, Starting Entry:  Field (GL_Cost_Center) is empty

4. Assign Token Values:  %(RetrieveFieldValues_GL_Account_All), %(RetrieveFieldValues_GL_Amount), %(RetrieveFieldValues_GL_Cost_Center)

The workflow seems to be reading them.  We don't need anything written out, just need to know if there is a blank.

5.  Conditional Decision:  This is where I'm stumped ... how do I create the condition to tell me if there is a blank?  I've tried multiple tests with zero luck.

Mary Volmer (mary.volmer@cfihope.org)

 

 

0 0
replied on September 1, 2022

You could do a count of values in the retrieved field. Then remove blanks and run the count again. If the 2 counts are equal, you have no blank values.

 

Make sure to tag the 2 counts as integers not string in Assign Token Value so they're compared as numbers in later conditions.

1 0
replied on September 7, 2022

Thank you Miruna.  That worked exactly as we needed it to!

 

0 0
replied on January 15, 2021

Since I was the one who posted this, I feel that I should post the solution. Here is the group field I'm working with. This is used for the approval (or review) of a document. 

A Form is filled out and I use Workflow to fill in the values when the form hits the repository. My users also can add a reviewer later. When they do, I have instructed them to fill in the reviewer decision and the decision date. That does not always happen. So I build this piece into the daily workflow that runs on these documents and notifies the users that they need to review the document. 

 

The first thing I do is retrieve all 3 values from the group field. Then use a For Each Value on the reviewer decision multivalue token. if someone left this blank, there will be a null value, and the condition is looking for that. When it's found, I modify a token I use as an indicator. The next condition is looking at that indicator to see if it is on. When it is, I count the number of reviewers and the number of reviewer decisions. Then another For Each Value on the reviewers. I create an empty multi-value token for the 3 values in my group. I set the condition to compare the number of decisions to the iteration of the for Each Value. That way the first values that are valid are filled into the New token. Once that's done, the other branch runs on the remaining iterations and fills in the Reviewer name and my default values I want. The last step is to replace the values on the document with my new values. 

This process seems like more work than needed to accomplish the goal of ensuring there are no blanks in a group field and the only reason I need there to be no blanks is that the SDK script I use to update a value crashes when there are blanks. If there was a native activity to update group fields that wouldn't crash if there was a blank, then I wouldn't need this enhancement to my workflow to correct the blank.  

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

Sign in to reply to this post.