Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!
SOLVED

Business Rule formula to check if documents added before completion

Avatar

Level 2

I have set up a basic formula to check if a document has been added to a task before the task is completed.   There are basically 2 pieces that would trigger the business rule error, if no document is added and if the after state value of the task status is complete (CPL or CPL:A).     

 

What works:    When I attempt to complete a task using the Percent Complete slider to 100% or change the status drop down to "Complete", I receive the error as expected - fantastic!

 

What is not working:   If I close a task through the "Mark as Done" option in a task, the formula does not appear to recognize the change and does not flag the error.   When i ran a Journal Report, it appears that a task that is closed via the Mark as Done button goes through a "DN" status and then moves into a "CPL" status.   I have attempted to account for this in the formula but still does not seem to catch a task from being marked as done without a task.  

 

Any ideas? 

 

Formula:  

IF(
     {hasDocuments}=false && 
    (CONTAINS("CPL", $$AFTER_STATE.{status}|| CONTAINS("DN", $$AFTER_STATE.{progressStatus})),
        "**** Warning! **** You cannot set this task to complete until a document is attached"
  )
 
 
Sample Images: 
 
Closed via Status drop down or Percent Complete Slider - works as expected
MichaelSMN_0-1730480338455.png

 

Closed via Mark as Done and the task closing without document (error we are attempting to prevent)

MichaelSMN_0-1730480446421.png

 

 
1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @MichaelSMN 

brilliant find. I can replicate this. I even tried 

IF($$BEFORE_STATE.{percentComplete}!=$$AFTER_STATE.{percentComplete} ....
 
and it still didn't fire. I would create a ticket - looks like a bug to me, as if the "Done" action doesn't raise the business rules. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

Hi @MichaelSMN 

brilliant find. I can replicate this. I even tried 

IF($$BEFORE_STATE.{percentComplete}!=$$AFTER_STATE.{percentComplete} ....
 
and it still didn't fire. I would create a ticket - looks like a bug to me, as if the "Done" action doesn't raise the business rules.