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
Is there any way to execute an expression rule by its UUID/Name. The UUID/Name of the rules to be executed will be saved in the DB, during the runtime the system should read the UUID/Name and execute the rule corresponding to it.
You can get a rule name by its UUID via the "getContentDetailsByUUID" rule found in a particular plug-in (probably Content Tools). However that doesn't change the fact that, as far as I know, there's no supported way to execute an expression rule by its name. (edit: Mathieu mentions below that the function "getrulereferencebyname" can do this. however as noted, this is cumbersome and confusing to use, and relies on old / potentially-deprecated features.)
This is why Mathieu raised the idea yesterday of executing Web API calls - because for these it's trivially easy to execute a call based on just the result of a string look-up (the API endpoint name is already just a string), and the other end of the API call can be paired to a Web API that points to its own expression rule (so if each person makes an expression rule for themselves, they'd also make a Web API object that calls it, and requires certain universal parameters that you enforce). Thus you'd just store the Endpoint Name in the DB.