Sunday, August 16, 2020

Determine Metasolv Rules and Behaviors executed on a Metasolv Order

PROBLEM


In Oracle MetaSolv (M6) Rules and Behaviors function is one of the 'out of the box' way to control and manage business rules for a client. However, sometimes its really required to understand which Rules and Behaviors are associated with a specific order at certain process points like while assigning a Provisioning Plan. During one of the testing for one of our key projects, we encountered a problem where a Rule was deleting a task on a new order for a customer and when the scenario for a change order flowed from upstream M6 encountered with Oracle Metasolv API errors.


Caused by: com.metasolv.common.MSLVXMLApiException: Exception Thrown Supplementing Order 19368***.
Message: null
........98 more
Caused by: java.lang.NullPointerException
at com.mslv.core.api.external.WM.processData.PopulateGatewayEvent.insertGWEvent(PopulateGatewayEvent.java:466)
at com.mslv.core.api.external.WM.processData.PopulateGatewayEvent.insertInfo(PopulateGatewayEvent.java:420)
at com.mslv.core.api.external.WM.processData.SaveTaskLogic.saveTasksExisting(SaveTaskLogic.java:253)
at com.mslv.core.api.external.WM.processData.TaskMaintainLogic.runRules(TaskMaintainLogic.java:118)
at com.metasolv.impl.logic.order.OrderBusObj.runRules(OrderBusObj.java:678)
at com.metasolv.impl.logic.order.OrderBusObj.processSupp(OrderBusObj.java:286)
at com.metasolv.impl.logic.order.OrderBusObj.processSupp(OrderBusObj.java:234)
at com.metasolv.impl.logic.order.OrderBusObj.processSupp(OrderBusObj.java:177)
at com.metasolv.ejb.order.PSROrderManagerEJB.processSuppOrder(PSROrderManagerEJB.java:334)



CAUSE


During troubleshooting, we figured it was rules and behaviors that were causing this problem. 
The Metasolv supplement API is reading the GATEWAY_EVENT_PLAN_TASK table for PLAN_ID and was trying to insert the gateway events for a certain task 'XYZ' which was deleted while assigning provisioning plan due to a new rule and behavior that we added. 

This is a bug in M6.2.1b1226 and needs Oracle Patch.

In such scenarios to find out the right rules and behaviors is a critical step in order to fix the issue.

The ASAP.SP_RULES procedure is leveraged to identify the Rules and Behaviors at the time of Provisioning Plans assignment to M6 order.

SOLUTION


1. Connect to Metasolv DB using any DB software tool and be ready with Metasolv Order Number

2. Based on the document Number find out the provisioning plan id.


select PLAN_ID from svcreq_provplan where document_number=”M6 Order Number”

3.  Use the M6 Order Number from step 1 as DOC_NUM and PLAN_ID from step 2 as PROV_PLAN_ID in the following PLSQL block. For PROCESS_POINT use 1 for the ‘Task Generation’ process and execute the block.


declare
  doc_num number;
  prov_plan_id number;
  process_point number;
  event_output varchar2(200);
  result number;
  error_text varchar2(200);

begin

  doc_num := “m6 order number”;
  prov_plan_id := “plan_id”;
  process_point := 1;
  asap.sp_rules ( doc_num, prov_plan_id, process_point, event_output, result, error_text );
  dbms_output.put_line( event_output);
  commit;
end;

4. The e_process_point_type table contains the definitions for the various process points MetaSolv supports. 
Process point 1 will be triggered as noted in the table at "Task Generation" and for "Initial provisioning plan assignment to a service request" and process point 121 Process Supplement and 122 Proc Supp and Task Generation.

5.  In the DBMS OUTPUT, you may notice the string as below. Below one is a sample of how the output would look like.


      214^*232^*360^*370^*404^*428^*440^*4540



6.  Use all the event Ids (214,232,360,370,404,428,440,454) from output of step 4 in event table to query about rules.


select  asap.event.event_name as "Rule",
asap.event.event_description as "Description",
asap.event.rule_active_ind
from    asap.event
where   asap.event.rule_active_ind='Y'
and     asap.event.event_id in (?)
order by asap.event.event_name;

Hope this article helps you find out the rules triggered for the M6 order and helps in further debugging. Please leave your feedback or query.