none
Using Nested If Else Conditions in a single branch of SharePoint Designer WorkFlow RRS feed

  • Question

  • I need to create a sharepoint designer workflow where i need nested if else conditions in a single branch. currently, each branch holds a single if else condition.

    I need to perform something like this
    If(Condition1 )
    {
    ----
    -----
    }
    Else
    {
    ---
    }

    All this should be kept in a single branch. and i have 6 if else conditions like this. can anyone help me if this can be achieved through the OTB designer workflow.
    • Moved by Mike Walsh FIN Tuesday, July 21, 2009 12:40 PM wf q (From:SharePoint - Design and Customization)
    Tuesday, July 21, 2009 12:22 PM

Answers

  • Hi,

    I understand that you want to use nested if else condition in a branch of SPD workflow like:

    If (condition 1)

      {If (condition2)

    {Action 1}

      }

    else

    {Action 2}

    In SPD workflow, it cannot use multiple level nested if else condition in a single branch. As a workaround, you need to change the nested if else to the logic below:

    If (condition1)

     and (condition2)

    Action 1

    else

    {Action 2}

    The limitation is that if the nested if else level is more than 2, the logic will be more complicated after your change to the format as above. Visual Studio will be a better choice.

    Hope this helps.

    Lu Zou

    • Marked as answer by Lu Zou-MSFT Friday, July 31, 2009 8:11 AM
    Thursday, July 23, 2009 4:03 AM

All replies

  • I'm not sure whether you can achieve this through SPD, you can try Visual Studio for this.
    Tuesday, July 21, 2009 12:31 PM
  • Moving to the Workflow forum.
    WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
    Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx
    Tuesday, July 21, 2009 12:40 PM
  • Hi,

    I understand that you want to use nested if else condition in a branch of SPD workflow like:

    If (condition 1)

      {If (condition2)

    {Action 1}

      }

    else

    {Action 2}

    In SPD workflow, it cannot use multiple level nested if else condition in a single branch. As a workaround, you need to change the nested if else to the logic below:

    If (condition1)

     and (condition2)

    Action 1

    else

    {Action 2}

    The limitation is that if the nested if else level is more than 2, the logic will be more complicated after your change to the format as above. Visual Studio will be a better choice.

    Hope this helps.

    Lu Zou

    • Marked as answer by Lu Zou-MSFT Friday, July 31, 2009 8:11 AM
    Thursday, July 23, 2009 4:03 AM
  • Couldn't you add a step 2 inside the first if clause to get the nested if?
    Wednesday, December 8, 2010 2:40 PM
  • Lu

    Can you please list out the steps or how can you do this in SPD 2010

    If (condition1)

     and (condition2)

    Action 1

    Thanks so much

    Swanl


    Swanl

    Friday, February 24, 2012 5:46 PM
  • I am trying to do this very thing with SharePoint designer. I have 3 (or more) possible categories.  If you choose RED, I want to update the INPUT field with the RedList.  If you select GREEN, I want the workflow to update the INPUT field with the GreenList.  I have tried multiple solutions (listed below), but in each case, only the first "if" statement (red in this case) works.  If I change the order (red, green, blue) the first IF statement in the list works fine, but the 2nd or 3rd will never work.  The INPUT field remains blank unless CATEGORY = the item in the 1st IF statement.

    What am I doing wrong here?  Thanks!!

    ----- 1st OPTION -----

    If Current Item: Category equals Red

       Set Contact to ContactList:RedList

    Else if Current Item: Category equals Green

       Set Contact to ContactList:GreenList

    Else if Current Item: Category equals Blue

       Set Contact to ContactList:BlueList

    ----- 2nd OPTION-----

    [Step 1]

    If Current Item: Category equals Red

       Set Contact to ContactList:RedList

    [Step 2]

    If Current Item: Category equals Green

       Set Contact to ContactList:GreenList

    [Step 3]

    If Current Item: Category equals Blue

       Set Contact to ContactList:BlueList

    Wednesday, November 20, 2013 7:45 AM
  • MS Steve,

    I have the same problem using SPD 2010.  Only the first If statement executes.  Have you figured this one out?

    Friday, May 16, 2014 6:36 PM