locked
IF, ElseIF and Else condition is not working in SharePoint Designer 2010 Workflow. RRS feed

  • Question

  • Hello,

    I am really confused and stuck in my Approval task workflow IF-Else conditions. If anyone can help me with this would really helpful and I do really appreciate your time and help.

    I have my Job request list and other lists created in SharePoint 2010 and modified in InfoPath 2010.

    So the workflow should work like the way I explained below…

    So basically once Job request submitted the workflow start automatically and assigned approval task to Manager and if the task is APPROVED then it check the IF - ElseIf conditions. Also , I have used FORM_URN tag link with the task email that sent out to Manager.So when manager click on that link it direct bring them to this page to APPROVE/REJECT task.

    So if Task APPROVED and Workunit:Assignement group = Acute then it will copy the current item to Acute committee list and email Ami same for SPH, Facilities, Medical Associates and Continuing Committee list I added all of them with ElseIf condition.

    If REJECTED it send an email to current item (created by) and END task process.

    See below screenshot for the condition which I added in SharePoint designer 2010 workflow.

    But when I publish the workflow and test it, the APPROVED process works fine but when the task REJECTED it did not work. I mean if the task REJECTED it should send an email to current item created by but it still copy the item to the different list same as APPROVAL does.

    So what am I doing wrong here? I know something wrong with the IF  - Else condition but it looks correct to me and I don't understand what is wrong here.

     Can anyone please tell me what am I doing wrong here in condition? Please explain with the step by step or screenshot would  really helpful.

    Thank you,


    priti patel




    • Edited by priti59 Monday, January 28, 2019 4:58 PM
    Monday, January 28, 2019 4:46 PM

Answers

  • In your first If statement you say If Approved and group = X. In the first Else If, you only state If group = y. If you only want this to fire when approved, you need to add that condition to this statement. Alternatively, you could have an If at the top that is if approved, then your else statement would be when rejected. So:

    If approved

         If cat = x

         else if cat = y

        etc

    Else

       what to do when rejected


    Please remember to mark as answer if you found this to be helpful. Andy Wessendorf

    • Marked as answer by priti59 Tuesday, January 29, 2019 4:15 PM
    Monday, January 28, 2019 5:50 PM

All replies

  • In your first If statement you say If Approved and group = X. In the first Else If, you only state If group = y. If you only want this to fire when approved, you need to add that condition to this statement. Alternatively, you could have an If at the top that is if approved, then your else statement would be when rejected. So:

    If approved

         If cat = x

         else if cat = y

        etc

    Else

       what to do when rejected


    Please remember to mark as answer if you found this to be helpful. Andy Wessendorf

    • Marked as answer by priti59 Tuesday, January 29, 2019 4:15 PM
    Monday, January 28, 2019 5:50 PM
  • Got the idea thank you Andrew that works. 


    priti patel

    Tuesday, January 29, 2019 4:17 PM