In IFS Apps 9 you can create your own rules (type External).
Unfortunately, there is nothing in the documentation about creating such rules.
There are only 4 examples in the code.
The question is, did anyone use it and have any other examples or documentation?
Best answer by paul harland
Please see if this fragment helps you with this topic.
External sales rules actions provide a way to call a custom Pl/Sql procedure in the IFS database. The Pl/Sql procedure can access any/all values in the configuration at that moment, and must return the full configuration back with any edits. From within that procedure, Oracle could provide the means to call external libraries, user exits, etc. to other technologies – but we don’t have any examples of that approach.
To develop an external rule you need to:
- Develop the rule – Add a new procedure to the IFS package Config_Sales_Rule_External_API. This procedure is responsible for all the necessary calculations and edits to the configuration. The configuration record is accessible from this procedure and must be returned with any changes (new/removed/edited configuration data).
- “Publish” the rule – Add the new external rule name and associated procedure to the IFS view CONFIG_EXTERNAL_DATA. This makes the rule available in the drop down list of External rules.
The external methods must be added into the Config_Sales_Rule_External_API package and also added to its view, CONFIG_EXTERNAL_DATA, for rules entry validation and LOV. They are then called upon in the following way from the rules logic:
- The entire configuration (all values, quantities, etcc) are set to the public variable eval_rec in Config_Sales_Rule_External_API.
- The rules logic calls the method Config_Sales_Rule_External_API.<Method-name> with no parameters.
- The configuration is read back from the eval_rec variable in Config_Sales_Rule_External_API.
This way the entire configuration can be manipulated within the custom method. The eval_rec is a Config_Sales_Rule_Manager_API. config_sales_eval_rec datatype, this is the type used internally in the rules engine validation and is defined as:
TYPE config_sales_eval_rec IS RECORD
char_id_ char_200_type, -- TABLE OF VARCHAR2(200)
char_value_ char_200_type, -- TABLE OF VARCHAR2(200)
char_qty_ number_type, -- TABLE OF NUMBER
char_flag_ number_type, -- TABLE OF NUMBER
The contents are sets of char id / value / qty / flag – where flag is identifying if the characteristic is required, current value is invalid or set to deleted. The rest are just the info needed for validation of order info and the message attribute string sent back to client.
The code for the demo methods for rounding and setting all values are simple, here is the Demo_Numerics_Round method:
idx_ NUMBER := 1;
rounded_ BOOLEAN := FALSE;
WHILE idx_ <= eval_rec_.num_chars_ LOOP
IF Is_Numeric___(eval_rec_.char_value_(idx_)) THEN
oldval_ := eval_rec_.char_value_(idx_);
eval_rec_.char_value_(idx_) := To_Char(Round(To_Number(eval_rec_.char_value_(idx_))));
IF oldval_ != eval_rec_.char_value_(idx_) THEN
rounded_ := TRUE;
idx_ := idx_ + 1;
IF rounded_ = TRUE THEN
Client_SYS.Add_To_Attr('MESSAGE', Language_SYS.Translate_Constant(lu_name_, 'VALROUND: Values rounded to the nearest integer'),