2

I am still new to SharePoint and workflows, so please bear with me.

I have a list consisting of sales orders that are on hold. I am trying to write a workflow so that when someone either A) enters a new sales order, or B) Updates a listing's "Credit Hold?" column, emails them with the updates. I have created a workflow that creates 2 boolean workflow variables. In the first part, it checks whether a sales order number changed or if a Credit Hold field is updated and saves this value (yes or no) to the workflow variables. In the second part, it takes the results of the variables and emails a list of people (me for now) the sales order number and if it is on credit hold or not. I ran the debugger and it doesn't pop up any results, then I try to publish it to the list and it gives me an error that says "Errors in the workflow prevent it from functioning correctly..."

Can anyone see what I could be doing wrong, and how to fix it? Thank you in advance.

PS yes, the emails are different for each "email William Smead" statement.

Screenshot of my workflow

  • Have you saved before publishing? Correct order is always save, then publish in SPD. And just to be sure I understand correctly: are the errors on running the workflow or on publishing? – Jan Jouke Tjalsma Jul 15 '15 at 21:03
1

I see one error right off the bat - it's not what's giving you the error message, but I believe it may prevent the workflow from doing what you expect in a certain circumstance. Your check on isCreditHoldChanged is inside an Else If block, which means that if Sales Order Number and Credit Hold? were both changed, then Credit Hold? (Before) won't get set equal to Credit Hold? until the next time the workflow runs, because the first condition being true prevents the second from ever being evaluated.

That said, there are a few possible causes of the error message that I can think of, though whether they apply or not isn't something I can tell from this image alone, you'll have to drill down into the selections to check.

  • If the two fields you're comparing in your If condition are not the same type, the workflow might not be able to compare them (for example, if Sales Order Number is a Choice column, but Sales Order Number (Before) is Text, the "Return Field As" setting for Sales Order Number would need to be changed from the default of As String to Lookup Value (as Text)).
  • The same situation, for your Set Field in Current Item action. I don't know if either of these will cause an error or just always evaluate to false, though, so...
  • Any workflow lookups within your Send Email action could be the problem. On the recipient selection, I have found that my workflows can behave quite differently depending on whether I pick a name directly from the "existing Users and Groups" box, type a name into the upper box, or type an email address into the upper box. Your results may also vary depending on your environment setup, e.g. how Active Directory is configured, etc.
  • Likewise, any workflow lookups or variables in the email body could have their "Return Field As" values set wrong and possibly cause an error.
  • Finally, if none of these are the cause, there could be a problem with the configuration of the SharePoint site, server, or Designer.
  • Yep! I ended up just rewriting the entire thing, and it now worked. Oddly, I am editing it in SPD 2013 as a 2013 workflow, publising it to Sharepoint Server 2010. I didn't notice I did that, but I actually corrected it anyway...thank you! – William Smead Jul 16 '15 at 14:13
  • Ah, publishing a 2013 workflow to a 2010 server could have been the issue too! – Dan Henderson Jul 16 '15 at 16:43
1

I just started over and redid the workflow and it works. Here is a copy of my new statements for reference.

Stage:Stage 1

Set Variable: SOChange to No
Set Variable: CreditHoldChange to No
Set Variable: OldSONumber to Current Item:Sales Order Number (Before)
If Current Item:Sales Order Number (Before) not equals Current Item:Sales Order Number
    Set Variable: SOChange to Yes
    Set Sales Order Number (Before) to Current Item:Sales Order Number
Else
    Set Variable: SOChange to No
If Current Item:Credit Hold? (Before) not equals Current Item:Credit Hold?
    Set Variable: CreditHoldChange to Yes
    Set Credit Hold? (Before) to Current Item:Credit Hold?
If Variable: SOChange equals Yes
    If Current Item:Credit Hold? equals Yes
    and Variable: CreditHoldChange equals Yes
        Email Will Smead
    Else
        If Current Item:Credit Hold? equals No
        and Variable: CreditHoldChange equals Yes
            Email Will Smead
        Else
            Email Will Smead
Else
    If Variable: CreditHoldChange equals Yes
    and Current Item:Credit Hold? equals Yes
        Email Will Smead
    Else
        If Variable: CreditHoldChange equals Yes
            and Current Item:Credit Hold? equals No
                Email Will Smead

Transition to stage

    Go to End of Workflow
  • 1
    Nice use of compound conditionals to reduce the if-else complexity! – Dan Henderson Jul 16 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.