Solved

Custom Event not working (Customer Order)


Userlevel 7
Badge +18

We have a custom event on the Customer Order that doesn’t appear to be working.

 

The idea is that when the user RMB > Release  the event fires and checks whether a custom field has been populated, the PLSQL is as follows:

 

declare
     eori_   varchar2(25);
     cursor c1_ is select cf$_eori from customer_order_cfv where order_no = '&NEW:ORDER_NO';

begin
open c1_;
fetch c1_ into eori_;
close c1_;
if eori_ is null  then
   Error_SYS.Record_General('CustomerOrder','MISSING_EORI: You must add the EORI reference before you can Release the Customer Order.  ' );
end if;
end; 

 

The event is fires when Objects are changed.

And the condition was set to NEW:ROWSTATE = Released

(even tried without any condition).

 

When  running in PL/SQL Developer and entering an order no and changing ERROR_SYS to dbms_output I get the message that I expected.

 

However, in IFS the customer order appears to just ‘Release’ without displaying the error message.

 

We have even tried using 

BEGIN

     Error_SYS.Record_General('CustomerOrder','MISSING_EORI: You must add the EORI reference before you can Release the Customer Order.  ' );

END;

 

I cannot see anything in the debugger either.

 

And still nothing.

 

Please help me stop going mad.

 

John

icon

Best answer by anmise 11 March 2021, 10:39

View original

This topic has been closed for comments

17 replies

Userlevel 5
Badge +10

Is the order code set up such that the release happens online? Or does the release of the order happen as a background job?

 

also, instead if checking against NULL you may want to check against COUNT, as in the past I’ve seen issues with NULL.

Userlevel 7
Badge +18

@malik.sally  Thank you so much for your speedy reply.   The event fires when the release happens, there is no background job.

 

Good shout about the COUNT, I was thinking about doing this instead of checking for null.

 

John

Userlevel 7
Badge +16

Hello,

 

Did you mean that the below code also not executed.

BEGIN

     Error_SYS.Record_General('CustomerOrder','MISSING_EORI: You must add the EORI reference before you can Release the Customer Order.  ' );

END;

 

I tried below and error appears at release.

 

Userlevel 7
Badge +18

@Dumeesha Wanigarathna Thank you so much also,

 

So it worked for you?

Userlevel 7
Badge +16

Hi,

 

Yes. I checked in our latest reference environment for app10. Check whether event and the action both is enabled. Initially I didn’t receive the error since the event is not enabled.

 

Userlevel 7
Badge +18

@Dumeesha Wanigarathna 

It still doesn’t work in our TEST environment, even though in PL/SQL Developer is does work. 

 

We do already have a custom event that executes on ‘Release’ of a customer order.  Is there a limit to amount of custom events that can fire on a Logical Unit/Table for a certain ‘Status’?

 

Thanking you.

 

John

Userlevel 6
Badge +15

 Hi @johnw66,

 

We do already have a custom event that executes on ‘Release’ of a customer order.

Have you added the new "Custom Event Action" to the same "Custom Event" mentioned above?

 

Cheers !
Dhananjaya.

Userlevel 7
Badge +18

@dhlelk 

 

I have tried updating the custom event action on the same custom event.

 

We have a custom event already that is triggered when the customer order is ‘Released’ that effectively credit checks the Customer/Customer Order.

 

Now I am trying to add another Custom Event that also triggers on ‘Release’ of the Customer Order.  This one is to check whether a custom field ‘EORI’ has been populated.

 

Each PL/SQL has been tested in SQL developer and works.

But doesn’t appear to be doing anything when in the Custom Event.   The Event and Event Action has been made ‘Active’.

Regards

 

John

Userlevel 7
Badge +18

Can you debug a custom event.

 

Userlevel 6
Badge +15

 Hi @johnw66,

 

We have a custom event already that is triggered when the customer order is ‘Released’ that effectively credit checks the Customer/Customer Order.

 

Now I am trying to add another Custom Event that also triggers on ‘Release’ of the Customer Order.  This one is to check whether a custom field ‘EORI’ has been populated.

Could you try adding a new "Custom Event Action" to the same "Custom Event" which you have already created for the credit checks on the Customer Order?

 

Cheers !
Dhananjaya.

Userlevel 5
Badge +10

Hi John,

Can you send the PL/SQL trace stack? if the event is not getting triggered which is highly unlikely it could be a problem with the framework.

Userlevel 7

We have a custom event on the Customer Order that doesn’t appear to be working.

 

The idea is that when the user RMB > Release  the event fires and checks whether a custom field has been populated, the PLSQL is as follows:

 

declare
     eori_   varchar2(25);
     cursor c1_ is select cf$_eori from customer_order_cfv where order_no = '&NEW:ORDER_NO';

begin
open c1_;
fetch c1_ into eori_;
close c1_;
if eori_ is null  then
   Error_SYS.Record_General('CustomerOrder','MISSING_EORI: You must add the EORI reference before you can Release the Customer Order.  ' );
end if;
end; 

 

The event is fires when Objects are changed.

And the condition was set to NEW:ROWSTATE = Released

(even tried without any condition).

 

When  running in PL/SQL Developer and entering an order no and changing ERROR_SYS to dbms_output I get the message that I expected.

 

However, in IFS the customer order appears to just ‘Release’ without displaying the error message.

 

We have even tried using 

BEGIN

     Error_SYS.Record_General('CustomerOrder','MISSING_EORI: You must add the EORI reference before you can Release the Customer Order.  ' );

END;

 

I cannot see anything in the debugger either.

 

And still nothing.

 

Please help me stop going mad.

 

John

Hi,

 

I’d recommend that you use the Application Defined event ORDER_STATUS_CHANGE instead. 
Just set the Condition to perform the action to Status = Released. 

 


I’ve tested this in my environment and it works fine.

​​​​​​​

Userlevel 7
Badge +18

@anmise 

Thank you.  I have tried that in our test environment and it doesn’t do anything, the Customer Order doesn’t get released but no error message is displayed, it’s a weird one.  The Action Enabled has been ‘checked’ and I carried out a ‘Reload Configuration’ on the Customer Order screen as well.

 

 

The Customer Order status = ‘Planned’ and the EORI reference field is empty, the Customer Order Line is ‘Released’ so no issue there either:

 

Thanking you.

 

John

Userlevel 7

@anmise

Thank you.  I have tried that in our test environment and it doesn’t do anything, the Customer Order doesn’t get released but no error message is displayed, it’s a weird one.  The Action Enabled has been ‘checked’ and I carried out a ‘Reload Configuration’ on the Customer Order screen as well.

 

 

The Customer Order status = ‘Planned’ and the EORI reference field is empty, the Customer Order Line is ‘Released’ so no issue there either:

 

Thanking you.

 

John

Ah, the lines will always be in status Released (there is no ‘Planned’ status for lines). This event looks at the header. Can you show us a screenshot of your order type? I’m almost certain you will have background jobs in error.
 

 

Userlevel 7
Badge +18

@anmise

The Order Types from Sales Basic Data:

 

 

 

I have included both as the orders I have tried to test were either Order Type ‘PF’ or Order Type ‘NO’.

 

Regards

 

John

Userlevel 7

@anmise

The Order Types from Sales Basic Data:

 

 

 

I have included both as the orders I have tried to test were either Order Type ‘PF’ or Order Type ‘NO’.

 

Regards

 

John

If you tick online processing for the order type PF, it will work. Otherwise the release will happen as a background job, which will fail with the message in your event.

Userlevel 7
Badge +18

@anmise Thank you ever so much for your assistance in resolving this issue.  It has finally worked by setting the Online Processing against the Order Type:grinning:

I am unsure how this worked originally other than someone must have changed the Online Processing flag in our Test Environment.  :frowning:

Thank you to everyone who tried to help with this.

Have a great day.

John