cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to catch Customer Creation event and its data in CCO Backend

AaronMendieta
Participant
0 Kudos
848

Hi Experts!

I need to catch in the backend the Customer Creation event as well as the data entered in the form.

Based on CCO console log I have been trying to achieve this via the next SAP (importing com.sap.scco.ap.pos.service, com.sap.scco.ap.pos.i14y.central.customer, com.sap.scco.ap.pos.service.impl,) classes and methods:

//****** TEST 1
@PluginAt(pluginClass= BusinessPartnerPosService.class, method="create", where=POSITION.BEFORE)

//****** TEST 2
@PluginAt(pluginClass= CustomerDataPosService.class, method="findOrCreate", where=POSITION.BEFORE)

//****** TEST 3
@PluginAt(pluginClass= CustomerDTO_CentralWebServiceImpl.class, method="post", where=POSITION.BEFORE)

//****** TEST 4
@PluginAt(pluginClass= BusinessPartnerErpServiceImpl.class, method="sendToBackend", where=POSITION.BEFORE)

//****** TEST 5
@PluginAt(pluginClass= BusinessPartnerErpServiceImpl.class, method="sendToERP", where=POSITION.BEFORE)

//****** TEST 6
@PluginAt(pluginClass= BusinessPartnerPosServiceImpl.class, method="create", where=POSITION.BEFORE)
		
//****** TEST 7
@PluginAt(pluginClass= BusinessPartnerPosServiceImpl.class, method="createFromDTO", where=POSITION.BEFORE)

//****** TEST 
@PluginAt(pluginClass= BusinessPartnerPosServiceImpl.class, method="updateFromDTO", where=POSITION.BEFORE)<br>

However, none of them seem to be triggered when debugging.

I have tried to do it via eventBus with JS as well, I succeed in catching the event when the creation form is triggered, naturally the payload of this event does not contain any data of the customer that is going to be created:

Any comment or guidance will be truly appreciated, thanks in advance, best regards!

View Entire Topic
Klaus_Frick
Active Participant
0 Kudos

Hi pamt

With FP12 I catch Customer Creation & Updates with:

@PluginAt(pluginClass = BusinessPartnerErpService.class, method="sendToBackend", where=POSITION.BEFORE)

With args[0] you should get the BusinessPartnerEntity. To identify if this is a creation or a update, I do query with the ExternalId (with BusinesspartnerManager) to get the possible old BusinessPartnerEntity. Maybe this helps.

But I agree with Robert, that a own UI would be the best solution.

Best Regards

Klaus

AaronMendieta
Participant
0 Kudos

Hi Mr. Frick, thanks in advance for taking the time to answer!

This event has responded when debugging, however, I have realized that the ID assignment process is not performed by CCO but CCOM, therefore at POSITION.BEFORE there is no customer ID to be fetched.
I have changed it to POSTION.AFTER but the event does not respond when debugging using this parameter.

Do you know if there is any other way to catch the event once the ID has been generated ID?

Any guidance will be appreciated, best regards!