Forum Discussion

WillVitale's avatar
WillVitale
Contributor II
21 hours ago

How to Recall Another Business Rule into a Different Business Rule

Hello,

Trying to build a business rule to send an email once a button is pressed. The business rule that I'm trying to use is encrypted and I cannot get into it so I was trying to figure out a way to recall that business rule to check if a Lease change status to submitted.

I read something about Referenced Assemblies, but I'm not fully sure if that's right or what I even code it as in my current business rule. 

This is the BR I'm trying to call into my current rule

Thanks,

Will

1 Reply

  • Chris-B-AIQOS's avatar
    Chris-B-AIQOS
    New Contributor III

    Hi,

    To call the business rule, the first step is to click on your rule's Properties tab and add the AELS_SolutionHelper rule to the Referenced Assemblies property. You would add BR\AELS_SolutionHelper.

    To call the ApprovalSolutionOverwriteFunction in the AELS_SolutionHelper rule, the function must be declared as Public and not Private.

    To make use of the public functions in the AELS_SolutionHelper rule, you need to create an instance of that rule in your rule. Assuming it is a Dashboard Extender rule, you would do:
    Dim targetRule as new OneStream.BusinessRule.DashboardExtender.AELS_SolutionHelper.MainClass()

    Assuming you are calling your rule as a Dashboard Server Task like this:
    {yourcustomrule}{yourcustomfunction}{LeaseList=[!|prm_SelectedApprovalLeases_AELS|!]}, the LeaseList parameter is passed as a Name-Value pair, so you must also create and populate that object when calling the AELS_SolutionHelper rule from your rule.

    Dim nvpSource As String = args.NameValuePairs.XFGetValue("LeaseList", String.Empty)

    Dim nvp As New Dictionary(Of String, String)
    nvp.Add("LeaseList", nvpSource)

    Dim targetDashboardArgs as New DashboardExtenderArgs()

    targetDashboardArgs.NameValuePairs = nvp

    Finally, call the function in the AELS_SolutionHelper rule. Assuming the return type is a string and that ApprovalSolutionOverWriteParameters expects the 4 parameters below:

    Dim result As String = targetRule.ApprovalSolutionOverwriteParameters(si,globals,api,targetDashboardArgs)


    I hope this provides some guidance on how to approach the solution.

    Kind regards,

    Chris