Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

If Statement on Custom Form - Compare Date Fields to Show not Meeting Deadlines

Avatar

Level 1

Hi,

 

I am attempting to create a custom form calculated field to show if we met our agreed upon due date.

 

We have a field on a custom form labeled 'SLA Date' that is auto generated with a date 5 days after submission - this field uses the current parameters of:

 

ADDWEEKDAYS({entryDate},5
 
I am then trying to compare that field to Actual Completion Date.
 
I am using the following parameters and continue to get 'N/A' - Does anyone have any idea why this is not pulling correctly? 
 
IF({DE:SLA Date}<{actualCompletionDate},"SLA MET","SLA Not Met")
 
I am trying to say - If 'SLA DATE' is less than 'Actual Completion Date' then put 'SLA MET'. If it is not put 'SLA Not Met'
 
If the reasoning is due to the 'SLA DATE' field being an already calculated field causing issues. I can also use another Custom Form Field - 'Expected In-Market Date' - which is just a standard Date Custom Form field. 
 
Any advise or guidance would be helpful. 
 
Thanks everyone! 
2 Replies

Avatar

Community Advisor

You might discover that the less than/greater than functions only work with numbers (not dates), so you might want to retool to say something like "if the difference between these two dates is less than (or greater than) some number".

 

e.g. IF(WEEKDAYDIFF({DE:SLA Date},{actualCompletionDate})>0,"SLA MET","SLA Not Met")

 

So basically think up some equation that results in a number being greater or less than some other number.

 

And, I would also double check to make sure your initial calculated field is formatted as a date field.

Avatar

Level 5

I recreated your DE:SLA Date in my sandbox environment, gave it a try, and it worked for me. My main difference is that on the "SLA Met" calculation, I added a condition to look at the project status and only check the DE:SLA Date if the Project Status was Complete.

Here's the code I used.

IF(CONTAINS("CPL",{status}),IF({DE:SLA Date}>{actualCompletionDate},"SLA Met","SLA Not Met"),"")

And here's some screenshots:

SLA Date_Screenshot.pngSLA Met_Screenshot.pngSLA Form_Example.png