Skip to main content
October 3, 2024

Testing

  • October 3, 2024
  • 1 reply
  • 0 views
Testing

1 reply

October 3, 2024

I have seen this done before with a dashboard extender BR.  

Here is some DB extender BR sample code that should get you started:

Namespace OneStream.BusinessRule.DashboardExtender.SetDefaultParamValue
	Public Class MainClass
		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardExtenderArgs) As Object
			Try
				Select Case args.FunctionType
								
					Case Is = DashboardExtenderFunctionType.LoadDashboard

						If (args.FunctionName.XFEqualsIgnoreCase("OnLoadMainDashboard_Sales")) Then	
							If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.Initialize And args.LoadDashboardTaskInfo.Action = LoadDashboardActionType.BeforeFirstGetParameters Then
								
								'Initialize Message
								Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
								loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True

								'Grab the default value to pass into the dashboard
								Dim defaultSalesperson As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Salesperson_DefaultValue")
																
								'Modify the workflow profile entity parameter to pass in the default value at run time
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("paramSecuritySalesPersonBase", defaultSalesperson)
								
'								brapi.ErrorLog.LogMessage(si, "defaultSalesperson = " & defaultSalesperson)

								Return loadDashboardTaskResult	
							End If
						End If
						
						If (args.FunctionName.XFEqualsIgnoreCase("OnLoadMainDashboard_SGA")) Then	
							If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.Initialize And args.LoadDashboardTaskInfo.Action = LoadDashboardActionType.BeforeFirstGetParameters Then
								
								'Initialize Message
								Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
								loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True

								'Grab the default value to pass into the dashboard
								Dim wfSGABranch As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "SGA_Branches_DefaultValue")
																
								'Modify the workflow profile entity parameter to pass in the default value at run time
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("SGA_Branches", wfSGABranch)
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("paramWFBranch", wfSGABranch)
																
'								brapi.ErrorLog.LogMessage(si, "wfSGABranch = " & wfSGABranch)

								Return loadDashboardTaskResult	
							End If
						End If
						
						If (args.FunctionName.XFEqualsIgnoreCase("OnLoadMainDashboard_CONSGA")) Then	
							If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.Initialize And args.LoadDashboardTaskInfo.Action = LoadDashboardActionType.BeforeFirstGetParameters Then
								
								'Initialize Message
								Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
								loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True

								'Grab the default value to pass into the dashboard
								Dim wfSGABranchCon As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "SGA_Branches_Copy_3_Default")
								Dim wfSGABranch As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "SGA_Branches_DefaultValue")
'								brapi.ErrorLog.LogMessage(si, "wfSGABranchCon = " & wfSGABranchCon)
								
								
								'Modify the workflow profile entity parameter to pass in the default value at run time
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("SGA_Branches_Copy_3", wfSGABranchCon)
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("SGA_Branches", wfSGABranch)
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("paramWFBranch", wfSGABranch)
																
'								brapi.ErrorLog.LogMessage(si, "wfSGABranch = " & wfSGABranch)

								Return loadDashboardTaskResult	
							End If
						End If
						
						
				End Select

				Return Nothing
			      Catch ex As Exception
				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
			End Try

		End Function
	End Class
End Namespace