Forum Discussion

jwagner's avatar
jwagner
New Contributor III
8 months ago

How to access journal name and the user who triggered the Journal Event Handler

Hello OneStream Community, 

I am wondering if anyone knows of a way to access the journal name and the user who triggered an action on a journal through a Journal Event Handler Business Rule.  

Dim returnValue As Object = args.DefaultReturnValue
	args.UseReturnValueFromBusinessRule = False
	args.Cancel = False

	Select Case args.OperationName
		'1.Submit 2.Approve 3.Reject
		
		Case Is = BREventOperationType.Journals.SubmitJournal
			If (args.IsBeforeEvent) Then
				si.WorkflowClusterPk.UniqueStringI
				Dim wfProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, _ 
					si.WorkflowClusterPk.ProfileKey)					
				
				Me.AddToLog(si, $"WFProfileName = {wfProfileInfo.NameAndDescription} - Journal Submitted")
				Dim wfGroupType = 6100 'Process wfGroupType
				Dim wfGroupUsers = BRAPI.Workflow.General.GetUsersInWorkflowGroup(si, _
					si.WorkflowClusterPk, wfGroupType, True, String.Empty)
							

 

 

 

  • The GolfStream application has examples of getting journal information. Here is a snippet:

    Dim journalID as Guid = CType(args.Inputs(0), Guid)
    Dim journal as JournalEx = BRApi.Journals.Metadata.GetJournalOrTemplate(si, journalID)						
    

    From there you can get the journal name like this:

    Dim jourName as String = journal.Header.Header.Name

    It also has examples of how to get user information if si.UserName is not what you want.

  • MarcusH's avatar
    MarcusH
    Contributor III

    The GolfStream application has examples of getting journal information. Here is a snippet:

    Dim journalID as Guid = CType(args.Inputs(0), Guid)
    Dim journal as JournalEx = BRApi.Journals.Metadata.GetJournalOrTemplate(si, journalID)						
    

    From there you can get the journal name like this:

    Dim jourName as String = journal.Header.Header.Name

    It also has examples of how to get user information if si.UserName is not what you want.