Skip to main content

Hi All,

 

I need a custom event in shipment screen. 

When Status is ‘Preliminary’  and Next Step in Shipment Flow = ‘Complete’ and Site = ‘A01’ then I need to enable my event. (all fields are highlighted in red) image 1

The action is check if any value in ‘Adjusted Net weight’ field in line part is zero/blank. then when user performs rmb and choose ‘complete’ an error messsage must shown to user. that “Adjusted Net weight is zero/null” (RMB is shown in image 2)

image 1

image 2

 

So, I created an event and action. Details are given below.

Event

Action Code:

DECLARE
  CONTRACT_ VARCHAR2(20):= '&NEW:CONTRACT';
  SHIPMENT_ID_ NUMBER := '&NEW:SHIPMENT_ID';
  STATE_OLD_ VARCHAR2(4000) :='&OLD:ROWSTATE';
  GET_NET_WEIGHT_ NUMBER;
  CURSOR C_ IS SELECT SHIPMENT_ID, SHIPMENT_LINE_NO FROM IFSAPP.SHIPMENT_LINE
  WHERE SHIPMENT_ID = SHIPMENT_ID_;

BEGIN

IF CONTRACT_ = 'A01' AND STATE_OLD_ = 'Preliminary' AND IFSAPP.Shipment_Flow_API.Get_Next_Step(SHIPMENT_ID_) = 'Complete' THEN
  FOR R_ IN C_
  LOOP
    GET_NET_WEIGHT_ := IFSAPP.Shipment_Line_API.Get_Net_Weight(R_.SHIPMENT_ID, R_.SHIPMENT_LINE_NO, 'TRUE');
    IF GET_NET_WEIGHT_ = 0 THEN
      IFSAPP.ERROR_SYS.RECORD_GENERAL('Error', '');  
ELSE NULL;      
    END IF;
  END LOOP;
  ELSE NULL;
  END IF;
END;
 

 

But when I use this code in action window, and try to perform the RMB. expected error is not shown in the application and the status of the shipment is also not getting changed. But when I disable event, status of the shipment is getting changed.

I need to show the error message in application and also status should not get changed, it must only get changed when error is not shown, means Adjusted Net weight must be a nonzero/non null value.

 

Please help to resolve this, thanks in advance.

Parallel approaches to solving this requirement is also welcomed...

Thanks in advance.

IFS Apps 10

 

Best Regards,

Hari

Hi @Harikrishnangr ,

 

The problem is well-defined. When comes to the problem. It is better to create the trigger for shipment lines. 


Although the event triggers before the change in status the function IFSAPP.Shipment_Flow_API.Get_Next_Step(SHIPMENT_ID_)  might not yield the correct result here, depending on your data. . The Event looks ok, in the Event Action on the top left set the “Conditions for performing this action” to OLD:ROWSTATE = Preliminary, NEW:ROWSTATE = Completed and OLD:CONTRACT = A01. Then run your loop and see if that changes anything.


On another note: I don’t think your event triggers at all. Your are assigning Shipment (Number) as a String since you are using ‘ ‘ around your variable. This would most definetly raise an event action error. You need to remove the ‘’ and check why your event does not trigger.

Also set the event to trigger AFTER the change (IFS will still rollback changes when you raise the error).


Also in your screenshot the checkbox for Event enabled is not set 🙂. Make sure your event and your event action are enabled.


I think when you click RMB complete then process is running through background job. code seems to be ok there is no issue . 

So first check in background jobs , process is running there or not . If it is coming in background job then you need to keep this process as online through setup . 

and If process is not coming in background jobs then you need to open debug , perform activity and copy main application code and run in pl/sql developer and debug that. 

You can inbox me if you need any help . 


I think when you click RMB complete then process is running through background job. code seems to be ok there is no issue . 

So first check in background jobs , process is running there or not . If it is coming in background job then you need to keep this process as online through setup . 

and If process is not coming in background jobs then you need to open debug , perform activity and copy main application code and run in pl/sql developer and debug that. 

You can inbox me if you need any help . 

Good point. You can check the Shipment Type to see if it’s set to run as a background job or not (it’s a checkbox there). Error would still be raised in the background job and should show there. I overread that the status of the shipment did not change so nehavertosync is very likely correct. If you want the error to be raised for the user it would only work if you process the shipment events online by unchecking the checkbox in teh shipment type.


Reply