Business Rule formula to check if documents added before completion | Community
Skip to main content
MichaelSMN
Level 3
November 1, 2024
Solved

Business Rule formula to check if documents added before completion

  • November 1, 2024
  • 1 reply
  • 690 views

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

 

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

 

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sven-iX

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. 

1 reply

Sven-iX
Community Advisor
Sven-iXCommunity AdvisorAccepted solution
Community Advisor
November 1, 2024

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.