-1

I am new to share point designer and workflows. I am supposed to create a Leave Planner where the employees can apply for leaves. I am trying to set up a condition that if:

  1. [Leave type= Annual Leave and From Date > Today's Date]

    • then, the user should be able to apply leave and the approval workflow will trigger an email to the manager. Else, a pop up window should display that "From date must be greater than today's date". Click "OK" to make changes. Until "OK" is clicked no other action should execute.
  2. [Leave type= personal leave, with no limitation on date selection], then, the user should be able to apply leave and the approval workflow will trigger an email to the manager.

I could meet the condtion 2, but uanable to fix up the condition 1.

I have created a workflow where I am able to calculate the comparison of From date with today's date, but I want a pop up window to prompt rather than just simply ending the workflow, if condition is not met.

I tried applying formula to the From date column in SharePoint, but by doing so I am applying the condition to all the leave types and I want it just for Annual Leave. I looked at other options and some suggest that this would require coding.

I have absolute no idea about the syntax and how to generate the code in SharePoint Designer and linking it with my workflow.

Here is the image of my workflow:

enter image description here

This is my SharePoint list: enter image description here

teylyn
  • 34,374
  • 4
  • 53
  • 73

1 Answers1

0

You can tackle that issue before it even hits the SharePoint Designer workflow.

In the list settings, you can click "Validation settings" and define what data entries are valid for the columns in your form. You don't need any coding or workflow for that.

The list setting:

enter image description here

Now you can't even enter a record with a date in the past. SharePoint will not allow you to save that.

enter image description here

So, don't worry the workflow with that. Check the data at the point of entry for validity and save yourself some headaches.

teylyn
  • 34,374
  • 4
  • 53
  • 73
  • Thanks Teylyn. This works but it is working for every type of leave. I want this condition to be true only when I am selecting Annual Leave, and for the rest of the leave types, this condition should not apply. – Ambika Bhatnagar Apr 12 '18 at 23:56
  • I am trying this formula: =IF([Leave Type]="Annual Leave","[From Date]>[Created]") – Ambika Bhatnagar Apr 12 '18 at 23:57
  • Why are you using double quotes in the TRUE section of your IF statement? And the TRUE statement is another comparison?? What are you trying to do? That won't fly. If you need to combine several conditions, you can wrap them in an AND() function. Look up the syntax for that in the Excel help. – teylyn Apr 13 '18 at 08:06
  • I have used double quotes because without them, it is prompting for syntax error. [leave Type] is a column where it is referring to its own value. That is why quotes are required. – Ambika Bhatnagar Apr 15 '18 at 23:52
  • Your IF statement contains a comparison in the TRUE section. That does not make sense. Did you try the data validation approach I posted? – teylyn Apr 16 '18 at 01:18
  • Yes, I have tried. It did not work. Logically, I want [start date]>created, so that it does not include today's date. The validation formula ou suggested is including today's date as well. However, to my surprise, when I tried with [start date]> created, then also it is including today's date. I know it should not happen, but this is happening. – Ambika Bhatnagar Apr 16 '18 at 05:31
  • Than I tried with [Start Date]>Created+1, and it worked. Logically, its wrong, but this is what is happening. – Ambika Bhatnagar Apr 16 '18 at 05:32