Quantcast
Viewing all articles
Browse latest Browse all 9063

How to prevent Contact Validate script from being executed twice?

We have added a script on Contact class (Class 600, Target Validated) which calls a third-party webservice to do some validations and create the user id of the new contact. Since user id (DB field name is NAME) is a unique field in Contact table, I had to write this script in Validated phase itself (before the contact record is saved in database). This contact validate script is working fine.

 

Now when a Supplier Registration is approved (from Supplier Management -> Registration -> Supplier Registration List, select a pending registration and approve), the user is taken to Create New Supplier screen. Here the primary contact details of the new supplier are already present (populated from details entered in registration form). If we just click Save button on this screen, the Contact Validate script is getting executed twice. This is the entry in log:

 

##sap.com/E-Sourcing-Server#C000CF8242BA0E3C0000002100000AD4#2174850000000004#sap.com/E-Sourcing-Server#E-Sourcing.eso.java.com.sap.odp.comp.scripting.ScriptManager.markLog#VAC53324#48##45CE2E8DDC2411E38616000000212F82#893b16f1dc2411e3985c000000212f82#893b16f1dc2411e3985c000000212f82#0#Thread[RequestHandler.RqThread: fullsave,5,Dedicated_Application_Thread]#Plain##

Facility=local4;sessionid=38266bf0e25b54b7b7ea2eed474d1b4749c44280;tenantid=\#xxx_context#;username=xxx;begin: executeDocumentEventScript for VALIDATE on null#

...............here debug logs from Call to the script written on Contact class, involves logic to call web service and create user id ..

 

#2.0 #2014 05 15 11:32:55:593#+00#Info#/Applications/E-Sourcing/eso#

##sap.com/E-Sourcing-Server#C000CF8242BA0E3C0000014D00000AD4#2174850000000004#sap.com/E-Sourcing-Server#E-Sourcing.eso.java.com.sap.odp.comp.scripting.ScriptManager.markLog#VAC53324#48##45CE2E8DDC2411E38616000000212F82#893b16f1dc2411e3985c000000212f82#893b16f1dc2411e3985c000000212f82#0#Thread[RequestHandler.RqThread: fullsave,5,Dedicated_Application_Thread]#Plain##

Facility=local4;sessionid=38266bf0e25b54b7b7ea2eed474d1b4749c44280;tenantid=\#xxx_context\#;username=xxx;begin: executeDocumentEventScript for VALIDATE on VENCON-0000067#


The first call to script creates the user id via web services and the second call fails because create is called again for an existing user. Can anyone please help me out - how can I prevent this second call from happening?



Viewing all articles
Browse latest Browse all 9063

Trending Articles