First, you need an event on request-map (controller) that match your sent uri
After you define a java service.

If you know service and controller and if the engine of your service is java you can use this :

*****
GenericValue myObject = delegator.findByPrimaryKey("MyObject", UtilMisc.toMap("id", id)); if (UtilValidate.isNotEmpty(myObject)) return ServiceUtil.returnError( "id already exist");

myObject = delegator.makeValidValue("MyObject", context);
myObject.create();
******

It's the greate line ;)

Nicolas


BJ Freeman a écrit :
it is really important you look through the code to find these answers.
there are many examples.
it will also get you familiar with how ofbiz works.

Vinayak Yadav sent the following on 10/29/2008 11:11 PM:
hi, all
I haved designed one student screen
i can able to enter ID and Save it.
now before saving the record i want to check that the ID is present or
not (duplicate ID)
and then i want to save it otherwise throw an error that 'Code already exists.'
how to do this?

Thanks
Vinayak





--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/

Reply via email to