Solved

Iterating through choice columns to trigger notification email.

  • 11 March 2019
  • 9 replies
  • 60 views

Hello all, 

I've been searching for an answer to this and can't seem to find one. I have a safety checklist Nintex form on SharePoint Online. The form is comprised of questions with choice options (radio button, choose one). The options are: satisfactory, unsatisfactory, imminent danger, not applicable. I need a workflow that will crawl through all the answers on each submitted form and check for "imminent danger". If found on any question it should trigger a task for the appropriate on-site person (identified by a seperate SharePoint Online list). The task also needs to identify which column or columns were identified as "imminent danger" so they know what to fix.

I've been trying to expiriment with loops with conditions with limited success. Any help would be most appreciated.

icon

Best answer by TomaszPoszytek 14 March 2019, 20:58

View original

9 replies

Userlevel 7
Badge +17

Hi,

 

Why cannot you do it as a list workflow? So that your list workflow checks if value of that specific choice field equals "imminent danger" and if yes - starts a task process?

 

Isn't that easier? If I am missing something, maybe you could attach a print-screen of your form?

 

Regards,

Tomasz

Badge +7

Thomaz is correct. What you would want to do at the list workflow level is have your workflow on a conditional start where the column = imminent danger. Then In your workflow, you can do a query list to get the on-site person who you then need to start a task process, you can also custimize the task form to show the same data as the intake form if you need to show what items have the imminent danger selection based on rules on the controls.

 

if you needed a task for each option, you will have to set a collection var and loop through it or when you do the list query to get the on-site person you will have to build a string or collection of people and assign a task to all of them.

 

Hope some of these ideas help.

Thank you both. Very helpful and the conditional start will work. But I'm still stuck on how to loop through the columns to pull out just the columns that have been marked as imminent danger. I need this so I can populate an email notification, as an email will go out to additional folks who aren't assigned the task, so the task form rules alone wouldn't be sufficient.

Userlevel 7
Badge +17

Can you provide some more information on the design of your data structure and form design? I cantc imagine what it looks like. Please attach at least the form design screenshot.

 

Regards, 

Tomasz

Sure thing. The start of the form looks like this.

 

The form goes on in sections like this. It's connected to an SP Online list that is primarirly choice columns. There are dozens of questions/columns. For any of the questions that contain the choice option "Imminent Danger", I want to be able to search for it, pull out the question if it was marked "Imminent Danger" and use it in an email notification to alert the recipients to that specific item that was causing imminent danger.

Apologies if this is confusing, it's much harder to articulate in type than when it's in my head.

Userlevel 7
Badge +17
Quick question - are all of these option questions mapped to SharePoint columns, or are they exist only in the form?

Regards
All are mapped to columns.
Userlevel 7
Badge +17

Ok, now it's clear. So now as I know they are mapped, I also know, that their number is fixed. You know how many fields should be checked for having a value "imminent danger".

 

Now you can do it in many ways. First, with conditional start - you set a sequence of checks, for each column that may have this value set, checking if it is equal that value:

  1. You have to built a separate "OR" rule per each field you expect to have value: "imminent danger"
  2. Add new sibling branches and set their relation to "Or"

Therefore your workflow will only start if in any of these monitored fields you have "imminent danger" value.

 

After workflow is started you need to check which of these fields have this value. You can do it either by checking each field separately, e.g. by adding multiple "Run if" actions, each action having a rule, checking if that field's value is "imminent danger":

And then "if yes", then by adding e.g. to a string variable name of the question, so that later this variable you can use in your task action, so the assignee will know in which questions initiator chose the "danger" value.

You can put those "Run if" actions one after another, or using "Parallel branch" action:

 

 

I am also thinking of a more clever way, that allows to save some precious actions, that is requiring a loop and collections, but I think this approach is just enough and a good start for what you need.

 

Regards,

Tomasz

Thank you for the help Tomasz. This will work perfectly.

Reply