Dynamically executing an expression rule by retrieving the rule name from DB

Certified Senior Developer

Hi Team,

I have a requirement to execute an expression rule by retrieving the rule name from the database. To provide a background on the ask: We have a landing page where tasks from various other applications/line of business is displayed. So every application designer would have to create an expression rule to return their tasks and then plugin to our common or parent expression rule. The parent rule consolidates all the tasks data from various applications and then display it in the grid. But the problem here is, one application might be in DEV phase, one in QA and another in UAT, so during the deployment there is always a problem due to the missing precedents and we have to comment out that rule that's not present in higher env and then uncomment it back. So in order to resolve this the business wanted to save all the rule names pertaining to each application in the DB and dynamically retrieve the rule name from DB and execute it.

I understand that we can pass the rule reference in the type "ANY", but in my case the rule name is saved as Text in DB.

Any ideas on this is appreciated.

Thanks

  Discussion posts and replies are publicly visible

Parents Reply
  • +1
    Certified Lead Developer
    in reply to Mathieu Drouin

    For those wondering, here's an example of what I meant using the apply function in combination with the getrulereferencebyname in the Content Tools plugin.

    Again, I don't recommend this approach as it becomes very difficult to find dependencies in your application and troubleshooting becomes difficult. The API approach is more robust IMO.

    a!localVariables(
      apply(getrulereferencebyname("S_DynamicRule"), {""})
    )

Children
No Data