Skip to main content
May 12, 2023
Solved

Requiring a document to be attached to a workflow step

  • May 12, 2023
  • 2 replies
  • 0 views

We have several workflows that for audit backup we have the users attach documents.  With employee turnover the next person didn't know they had to attach the document.  Is there something like an After Event rule you can do to check that something was attached or in a confirmation step?

Best answer by KurtMayer

Hi, a Confirmation Rule check is very easy to use for enforcement of business processes.  Here is a code snippet we use in our courses, of how you could check for an attachment if an account has a non-zero amount, thereby requiring a supporting details attachment:

 

'Check an Account value and if it is greater than zero, request a file be attached
args.ConfirmationRuleArgs.DisplayValue = api.Data.GetDataCell("V#YTD:A#60999:F#None:O#Forms:I#None:U1#None:U2#Services:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None").cellAmount
If args.ConfirmationRuleArgs.DisplayValue = 0 Then
    Return True
Else
    'We failed the value test, check for a file
     If api.Data.HasDataAttachmentsWithFile("V#Annotation:A#60999:F#None:O#Forms:I#None:U1#None:U2#Services:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None") Then
         'We have a file attached, so pass the  rule
         args.ConfirmationRuleArgs.Info1 = "File attachment found"
         Return True
     Else   
         'File not found, we fail
         args.ConfirmationRuleArgs.Info1 = "File Attachment Missing. Navigate back to the Product Sales Form and add an attachment as an Annotation to the Services data cell."
         Return False
     End If
End If

 


You would attach that as the Rule Formula to a Confirmation Rule that might look like this:


KurtMayer_0-1683914430871.png

 



2 replies

May 12, 2023

You can definitely use the DataQualityEventHandler to look and make checks in between steps in a workflow. You should then be able to use GetDataAttachments as a Boolean event and determine if it should stop the workflow. Alternatively, if you're using Confirmation Rules, you should be able to utilize that in a similar way.

johnal67Author
May 12, 2023

Thank you for the confirmation and information!   I was thinking somewhere I'd seen you can before.

KurtMayerAnswer
May 12, 2023

Hi, a Confirmation Rule check is very easy to use for enforcement of business processes.  Here is a code snippet we use in our courses, of how you could check for an attachment if an account has a non-zero amount, thereby requiring a supporting details attachment:

 

'Check an Account value and if it is greater than zero, request a file be attached
args.ConfirmationRuleArgs.DisplayValue = api.Data.GetDataCell("V#YTD:A#60999:F#None:O#Forms:I#None:U1#None:U2#Services:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None").cellAmount
If args.ConfirmationRuleArgs.DisplayValue = 0 Then
    Return True
Else
    'We failed the value test, check for a file
     If api.Data.HasDataAttachmentsWithFile("V#Annotation:A#60999:F#None:O#Forms:I#None:U1#None:U2#Services:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None") Then
         'We have a file attached, so pass the  rule
         args.ConfirmationRuleArgs.Info1 = "File attachment found"
         Return True
     Else   
         'File not found, we fail
         args.ConfirmationRuleArgs.Info1 = "File Attachment Missing. Navigate back to the Product Sales Form and add an attachment as an Annotation to the Services data cell."
         Return False
     End If
End If

 


You would attach that as the Rule Formula to a Confirmation Rule that might look like this:


KurtMayer_0-1683914430871.png

 



May 12, 2023

This is the right answer. There is even a Snippet to do this sort of work.

September 27, 2023

Hello,

I see the solution listed above works for Forms.  Is there something similar for Journals where workflow, account and all other dimensions are variable?

Thanks,