If you know how to write code in a programming language that is supported by the .NET Framework, you can define parameters directly in custom code.
Create as much of the rule as possible using Rule Builder and Rule Parameters Editor, so that the RBA Rule Engine builds most of the code to implement the rule that you have defined. To add your custom code, use the Advanced: Convert to Code option in Rule Parameters Editor.
Note: After you edit the code, you cannot change parameter values using the basic Rule Parameters Editor until you reset all the parameters to their default values.
- Double-click the action for which you want to set the parameters.
- In Rule Parameters Editor, click Advanced: Convert to Code.
- In Parameter Code Editor, add to or change the existing code.
- Click Compile to test whether the code can compile.
It is important to perform a test compile when you are finished writing code. This ensures that the code is valid and will compile with the other RBA code.
- Click Save.
The line between the event and action becomes a dotted gray line ( ) instead of the solid gray line ( ) that appears when you set the parameters in the usual way with Rule Parameters Editor.
- Save and close the rule set.
If the code in any one of the event-action pairs in the rule set does not compile, an error message appears and you cannot save the rule set. Also, the line between the event and action turns red ( ), indicating that the parameters are not set correctly in the code.
Tip: If you later decide to stop using code for a particular event-action pair, right-click the line between the event and action, and select Reset to Default.