Skip to main content
February 27, 2025

Make document attachment required on journal

  • February 27, 2025
  • 2 replies
  • 0 views

Hi Everyone,

Our business team would like to make it mandatory to attach a document to every journal entry.  I know this can be done via a confirmation rule.  However, one of our business partners googled this and AI returned the information in the screenshot below so they are questioning why we can't enable the setting referenced.  We can't find this in any of the OneStream documentation nor see it when creating new workflow forms or journal templates.  Is anyone familiar with this setting?



 

2 replies

February 28, 2025

As far as I know that does not exist. If you try the same question in ChatGPT it talks about a setting called 'Pre-Save Validation Rule' which definitely does not exist (but sounds like a great idea). The AI models do not understand OneStream so anything they say has to treated with caution. The only way you will be able to do this is to use an EventHandler. SaveDataEventHandler is probably your best bet - you can intercept the Save event and check that there is an attachment for journals. It will have an impact on performance though as this will run every time a user saves any data anywhere in the application. You will have to look at how to drop out of the BR as soon as possible if it's not a journal being saved.

wolfeeAuthor
March 3, 2025

Thanks Marcus.  We were fairly certain the AI response was a false positive and I found an earlier post about the SaveDataEventHandler.  We'll look into that and keep in mind about dropping out of the BR if not a journal being saved.

June 7, 2025

Hi there,

Guessing you probably solved this one already, but if you create a JournalsEventHandler business rule with the following, it will prevent a journal from being posted without an attachment. 

 

Public Class MainClass

            Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As JournalsEventHandlerArgs) As Object

            Select Case args.OperationName

                  Case Is = BREventOperationType.Journals.PostJournal

                        'Attachment Check:

                        Dim wfClusterPk As WorkflowUnitClusterPk = si.WorkflowClusterPk

                        Dim Info1 As String = Nothing

                        Dim objList As JournalsAndTemplatesForWorkflow = BRApi.Journals.Metadata.GetJournalsAndTemplates(si,wfClusterPK,)

                  'Define counter

                  Dim x As Integer = 0

                  'Set cycle

                  For x = 0 To objList.Journals.Count - 1

                        'Get line items in current journals

                        Dim objJournalEx As JournalEx = BRApi.Journals.Metadata.GetJournalOrTemplate(si, objList.Journals.Item(x).Name)

                        'Check for attachment

                        If objJournalEx.Header.HasAttachments = False Then

                              Throw New Exception("Error: Journals must have supporting documents attached before posting")

                              Else

                              Return Nothing

                        End If

                  Next

            End Select

            End Function

      End Class