KannanManickam
Scholar

Switch Logic with Email Notification

Jump to solution

Dear All,

I am trying to send customised emails to 2 set of users based on the list value input by users. For example, if the user select Japan in the SharePoint form, an email should be sent to Japan users; Similarly if the users select Peru, it should be sent to Peru users.

 

I have set up the workflow as shown but it is not triggering any email. May I know where did I go wrong? Much appreciate your help!

 

Switch.pngSwitch1.pngSwitchEmail.png

 

 

 

 

 

 

 

0 Kudos
Reply
11 Replies
emha
Collaborator

Re: Switch Logic with Email Notification

Jump to solution

if you check workflow history of a finished workflow, does it step through any of mail actions?

are you sure 'Country' contains a value resp. expected value?

 

to investigate, you could enable "Include an other branch" and within the branch send notification with Country value to yourself or write the value to history log.

0 Kudos
Reply
KannanManickam
Scholar

Re: Switch Logic with Email Notification

Jump to solution

SetCondition.PNGSwitchAction.PNG

 

Hi Emha,

Thanks for picking up my enquiry and sharing the knowhow. I feel you are right. The Country item in the list is a look up field, drawing from another list. Could this be the reason why it didnt work? 

 

As you have suggested, I have included Other brach and received notificaiton for a coutry (Australia) that is not specified as one of the values for the 'Country'. Is there a way to make the look up field work in this?

 

Under Set Condition option, there is this option to make the look up item work. However, in Switch Action, this is not available.

 

0 Kudos
Reply
emha
Collaborator

Re: Switch Logic with Email Notification

Jump to solution

yes, lookup is the reason. switch actiononly supports plain text or numeric control value to switch by.

for lookup you will need first need to get lookup text or ID value and store it to a variable. and then configure the switch action to decide by this variable.

View solution in original post

Reply
KannanManickam
Scholar

Re: Switch Logic with Email Notification

Jump to solution

Hi Emha,

 

Thank you very much. I guess, I can't use Switch funciton then, unless put in a workflow to copy the look up field into another list item and then use it for the Switch.

 

To copy within the list, do you think any of the workflow function can be used? Anyway, many thanks again for your reply.

0 Kudos
Reply
emha
Collaborator

Re: Switch Logic with Email Notification

Jump to solution

 

...unless put in a workflow to copy the look up field into another list item

 

no, you don't need to copy anything to another list item, nor to another list field for a current item.

 

the truth is you cannot use switch action directly on lookup list field. but as mentioned above, you can copy/store lookup list field value into a workflow variable and make switch by that variable.

0 Kudos
Reply
KannanManickam
Scholar

Re: Switch Logic with Email Notification

Jump to solution

Hi Emha,

Thank you for your guidance, one item worked. Basically, I have set the variable to look up list item. Then, In the swtich control, I referred to the variable. Picture as shown below for SGemail. In the form, when I select Singapore, I get the SGemail. However, how do I add the Chinaemail in the switch? As you can see below, only one variable can be selected to match the value in the switch.

 

Look forward to your guidance. Thanks, Kannan.

 

 

SGEmailSGEmailSG Variable to Look Up ListSG Variable to Look Up List

 

 

0 Kudos
Reply
emha
Collaborator

Re: Switch Logic with Email Notification

Jump to solution

you should populate variable from respective list field (Country?) from current item, not from Countries master list.

0 Kudos
Reply
KannanManickam
Scholar

Re: Switch Logic with Email Notification

Jump to solution

Hi Emha,

I still don't get to run it successfully. Only the Others run for this. Below is how I have set up the Variables (for China and Singapore) and the Swtich value as shown. Appreciate if you can comment, if I am mapping wrongly! Thanks.

ChinaEmailVariable.PNGSwitch01.PNG

EntireWorkflow.PNG

0 Kudos
Reply
emha
Collaborator

Re: Switch Logic with Email Notification

Jump to solution

once again, to get a lookup field value from an item the workflow is running on, you have to reference 'current item'. so it might look like this

i.jpg

 

 

and then use CountryName variable in switch action

 

Reply