SharePoint Designer Workflow Conditions

bis2345
bis2345 used Ask the Experts™
on
Hi,
I'm in the process of creating a workflow and I'm having trouble accomplishing the following.

My condition should be something like that:

If (field1 is not empty and field1A=1) or (field2 is not empty and field2A=1)
then do my actions.

Currently I have it like this:
If field1 is not empty and field1A=1 or field2 is not empty and field2A=1 which steps into the actions even when field2A=0 .

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Might have an order of operations tangle.  For simplicity and headache avoidance, I separate these into 2 steps: if the first condition isn't met, the workflow stops.  If it doesn't stop and the second condition is met, then do the actions.

Author

Commented:
Thank you for your reply. I just showed 2 conditions but in reality I have 8. I don't want to run the action if second condition is only met. Maybe if I explain the business requirement it will be easier.

I have 8 users involved in the approval process of an infopath form. But those 8 users are not always defined so I might have at one point 8 approvers and for another form I might have 7 or 6.
Once those 7 or 8 users are defined they all need to approve it before executing the actions. If one rejected or didn't do anything yet, I don't want to execute the action.

In my example above:
Field1 represents user  A and Field1A the approval field.
Field2 represents user B and Field2B the approval field
and so on.

Thank you

Commented:
Ah.

An out of the box approval workflow run serially will work.  You can name the approvers, they get it one at a time, and the WF stops if one of them rejects, with the WF status = stopped.  If they all approve, WF status changes from In Progress to completed, which fires off another workflow on the item that runs when the item changes and WF status = Completed, then executes your actions.

If WF status = stopped, then someone can get notified.

What's in the approval field?  Yes/No?  Rejected/Approved?  Comments?
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
I have actually 2 approvals processes involved. One is parallel and one is serial.
The serial should ONLY start when all approvers in parallel approved. This is why I asked my question, because with my conditions the sequential starts eventhough someone in parallel rejected or didn't do anything.

I don't think out of the box will work for many reasons. One of the reason is I don't know who are the people involved in the approval process. Currently the admin user go into each form and define the approvers.

Thank you

Commented:
Lots of clarification questions:

1. What happens in the parallel process - how many of your up to 8 approvers are involved in that, and
2. What happens in the serial process - how many of your up to 8 approvers are involved in that one, or is that just the execute actions piece?

3. Is there is a repeating table field in the form for Approver 1 name, Approver 2 name, etc. or are those defined at workflow initiation?
4. Is the approval variable a WF variable or is it a field in the form?
5. What is the data type of the approval field?  Checkbox? Option button? Single line of text?

6. The parallel approval process fires when the form is submitted to SharePoint?
7. The serial approval process is supposed to fire only when all up to 8 approvals are positive, correct?

8. Do the name of the approvers and their responses go into SharePoint or do they stay in the form or are they just workflow variables?

9.  The WF should stop if any one approver rejects the form, correct?

10. How is the approval WF started?
11. How is the actions WF started?

These may seem convoluted, but I think I'm going somewhere with it...

Author

Commented:
I really appreciate your help because I've been working on this for a long time and it is so complicated.
Here is a full explanation and I hope I get to answer all your questions.

A user submits the form, so a workflow on "new" is fired notifying the admin user that a new form is submitted and that he needs to go and define the approvers. The admin opens the form, look at couple fields and decide who need to be in the parallel and who need to be in the serial.
Approvers are illustrated by drop down list on the form that the admin pick from.We have 8 dropdown lists for parallel and another 8 for serial. The admin might pick all of the 16 or maybe 5 from parallel
and 6 from serial. By each dropdown list and hence a name there are 3 options: Approve, Reject and Review.
Each user involved in the parallel process will get an email notifying them that they need to go and review the form and choose from option button: Approve, Reject or Review by their name. If they choose Review then a reminder gets sent after 48 hours notifying this specific user that they still need to Approve or Reject. If they didn't choose any of the 3 options a reminder gets sent after 24 hours. If one rejected, then an email gets sent to the requestor notifying him/her that this person has rejected and the workflow stops for this specific user. However, other users in the parallel and their corresponding workflow are still running and they can still go and approve.
At the end of the parallel process all 5 users need to approve (choose option Approve) before the serial approval process starts. And this is where I'm checking in my workflowto make sure that all my up to 8 users, in this example I have 5, approved then my action set a field to "Parallel Approval Is completed". I use this field to fire the serial process.

In the serial process, in the example I gave I have 6 (in other situations I might  have 8).
I'm aware though of the logic of when we might have 6 users or 8 or even 2. Based on this logic, i'm able to identofy the chain which is not the case for parallel.
After all my users in the parallel process approved. The first user in the sequential receives an email and of course he/she needs to do something: Approve, Reject or Review. If Review is selected a reminder gets sent after 48 hours, if they didn't pick anything a reminder gets sent after 24 hours. The next person in the chain doesn't receive an email until the previous person have "Approved".

To accomplish all the above I had to create for parallel approval process a workflow for every position involved. So I have 8 workflows which checks to see if there is a name and if yes it starts sending email, reminders, etc...
For serial, among 8 users, I can have 7 different combinations of users so I'm planning to create 7 other workflows, not sure if this is the best way. I just started with the first one when I ran into the issue of conditions and serial firing before parallel is complete.

To answer directly your questions:
1 and 2 are described above.
3- There is no repeating table, there are 16 different drop down lists. Each list has different name in it.
4- Approval variable is a field on the form and 5- it is of Option button datatype.
6-The parallel process starts "on change" since when the form is submitted, approvers are not known at this point.
7- Correct, when all users in parallel have "Approved"
8- Yes the names and their responses go into SharePoint
9- In the parallel process: because i have many workflows, one for evey name involved, yes the workflow stops for this person if he/she rejected. But it doesn't stop the other workflows running for the other users involved in the parallel process.
As for serial in every workflow (since i might have 7 different combinations=7 different workflows but only 1 will run for every form and not the 7 of them of course) yes if someone in the chain rejects it should stop.

I think I explained 10 and 11 above.

My solution might not be the best. I would really appreciate it if you have better ideas. Really the reminders are causing problems which made me change so many things to make it work.

Thank you and I hope this clarified what I'mt rying to do.

Commented:
Wow.  That is complicated.

Does the serial WF check to see if the "Parallel Approval Is completed" field (what's the field name?) says "Parallel Approval Is completed" before it starts?

Commented:
From your original post:
If (field1 is not empty and field1A=1) or (field2 is not empty and field2A=1)
then do my actions.

I think the OR should be an AND.  You're telling it to go if (either field1 is not empty and field1A=1) OR (field2 is not empty and field2A=1).  It's doing what you're telling it to do, so if field1 has content and is approved, and field 2 is empty and blank, it's going to fire because it's fulfilled the first condition.

Try making that simple change and see if it works the way you WANT it to instead of what you TOLD it to do.

Author

Commented:
Yes the serial workflow does check this field but for some reason, the "IsParallelAprpovalCompleted" field is not being set correctly. This was my question initially, because it does get set to "True" when it should be false.

Author

Commented:
I didn't get what you wanted me to change?
 My condition in the workflow don't have () and I'm trying to find a way to do so. I do need the () but I don't think there is a way to do it in SharePoint Designer Workflow.

Commented:
From your original post:

If field1 is not empty and field1A=1 or field2 is not empty and field2A=1 which steps into the actions even when field2A=0 .

Try:

If field1 is not empty and field1A=1 AND field2 is not empty and field2A=1

() were my addition, and I put the first one in the wrong place, sorry....

Author

Commented:
The problem in using AND is that field 2 might be empty (which is one of my parallel user) and hence I don't care about its field2A and at this point I wanted to step into the action.

Commented:
Hm.  You're right.  This is hard to do long distance.  

So let's go back to the original problem:
"IsParallelAprpovalCompleted" field gets set to "True" when it should be false.

What triggers it to be True?

You said: "If one rejected, then an email gets sent to the requestor notifying him/her that this person has rejected and the workflow stops for this specific user. However, other users in the parallel and their corresponding workflow are still running and they can still go and approve."

If one rejects, why have the others continue their approval?  Won't the form need to be approved again by all if a change is made to address the objection of the rejecter, because the actions WF won't fire unless all of them approve...


Author

Commented:
IsParallelApprovalCompleted gets set to True when: all defined users in parallel process has approved and it gets set to false when one user at least from the parallel approval process rejected.

This is a business requirement. They don't want to stop the parallel process if someone rejected.

Thank you and I know it is hard to do something like this long distance and so complicated. But thank you for all your help.


Commented:
What's the default value for that field?  Is it a boolean value?  I have had trouble with those in the past - sometimes Sharepoint sees it as a 1 or a yes, and Infopath sees a true or a 1.  If you change that flag from boolean data type to a text string and set the serial WF to go when that field matches the string "ParallelApprovalCompleted" or something like that, it might work.

Author

Commented:
Ah great! That was it :) I changed the type from boolean to number and now it is working.

Thank you very much. I would have never guessed that this could be the issue.

Commented:
You're very welcome.  I'm so glad I could help.  Sorry I didn't ask that first, since I've been bitten by that before, but at least we got it.

-Nancy

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial