Skip to main content
September 29, 2025
Question

Output as constant in Decision rule

  • September 29, 2025
  • 2 replies
  • 0 views

I have a requirement where similar nested if conditions are required in multiple interfaces. So I'm trying to build a decision rule so that if there is any update required it can be done in the rule and it can reflect in all interfaces. But the outputs are list of ids which are stored across different constants for each condition. For example, If condition 1 satisfies I want the output to be constant1 and if condition 2 satisfies I want the output to be consant2. Each constant has more than 50 ids and I want the output to be in the same order they are present in the constant. While configuring the decision rule I'm able to see all the ids from all the constants and I have to manually select them for each condition and that too in the same order I want the output to be in. Is there any easier way or is there any way to give the constant directly as output? For now I have created expression rule and used a!match to make it simple but curious to know the above mentioned scenario.

2 replies

harshas2775
September 29, 2025

In Decisions directly constants cannot be referred. A simpler way to get desired result is in the Decision's output have the decision object return 1 or 2 simply. Not the values from constant rather just a pointer to which constant you need. Like this

Wherever you call this decision rule, add an if() so that if decision rule returns 1 constant 1 is referred (order will be maintained and handled future changes in constant too), if 2 is returned constant 2 is referred. Basically move the constant out of the decision rule and just work on conditions there. 

shubhama926776
September 29, 2025

You cannot reference constants directly in Decision Table outputs. Your a!match() expression rule is the correct approach for this scenario.
Or
Create a decision rule that outputs a simple key ("cond1", "cond2"), then create an expression rule with logic like:

if(
  rule!decisionRule(param) = "cond1",
  cons!constant_1,
  rule!decisionRule(parameters) = "cond2",
  cons!constant_2,
  {}
)