You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Ritesh K Kaushik <ka...@gmail.com> on 2012/01/04 12:04:28 UTC

Ofbiz

If we enter a duplicate Primary key in Ofbiz then it gives a long error
message, is there any way to customize those messages.

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4260861.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Sushil Mahajan <su...@hotwaxmedia.com>.
Hello Ritesh,

    You don't need to fetch all the records and then match the Primary key with the field value.
    you can use the "productId" you have from the form-fields to fetch a single record and then check if it is non-empty , and show an error message. 

example:---
   <entity-one entity-name="Product" value-field="product"/>
       <if-not-empty field="product">
           <add-error>
               <fail-property resource="ProductUiLabels" property="ProductIdAlreadyExists"/> 
           </add-error>
           <log level="info" message="${ProductUiLabels.ProductIdAlreadyExists}"/>
           <else>
               <check-id field="newEntity.productId"/>
           </else>
       </if-not-empty>
       <check-errors/>


Thanks and Regards
Sushil Mahajan.




----- Original Message -----
From: "Jacques Le Roux" <ja...@les7arts.com>
To: dev@ofbiz.apache.org
Sent: Saturday, January 7, 2012 5:08:07 PM
Subject: Re: Ofbiz

To second Adrian,

Please use rather user ML for such questions, see why here :
http://cwiki.apache.org/confluence/display/OFBADMIN/Mailing+Lists#MailingLists-DesignanddevelopmentList:dev@ofbiz.apache.org

Thanks

Jacques

From: "Ritesh K Kaushik" <ka...@gmail.com>
> Hey,
> 
>    I found that service in ProductServices.xml, but can't find where they
> have iterated and checked for duplicate primary keys.
>  Please elaborate.
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4271979.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Jacques Le Roux <ja...@les7arts.com>.
To second Adrian,

Please use rather user ML for such questions, see why here :
http://cwiki.apache.org/confluence/display/OFBADMIN/Mailing+Lists#MailingLists-DesignanddevelopmentList:dev@ofbiz.apache.org

Thanks

Jacques

From: "Ritesh K Kaushik" <ka...@gmail.com>
> Hey,
> 
>    I found that service in ProductServices.xml, but can't find where they
> have iterated and checked for duplicate primary keys.
>  Please elaborate.
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4271979.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Ritesh K Kaushik <ka...@gmail.com>.
Hey,

    I found that service in ProductServices.xml, but can't find where they
have iterated and checked for duplicate primary keys.
  Please elaborate.

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4271979.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Sascha Rodekamp <sa...@googlemail.com>.
Hey, 
you could check the createProduct service. There is a small block where this check is done and a friendly message, in case of a duplicate primary key, will returned. 

Best Regards

Am 04.01.2012 um 20:37 schrieb Adrian Crum <ad...@sandglass-software.com>:

> This question should be asked on the user mailing list.
> 
> The best approach is to do a find on the primary key, and if a value is found, return a user-friendly error message.
> 
> -Adrian
> 
> On 1/4/2012 11:04 AM, Ritesh K Kaushik wrote:
>> If we enter a duplicate Primary key in Ofbiz then it gives a long error
>> message, is there any way to customize those messages.
>> 
>> --
>> View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4260861.html
>> Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Ritesh K Kaushik <ka...@gmail.com>.
Hi Adrian ,

   If i am using my java class, i can iterate, but if there service is used
i don't know how to iterate.Can u pls.
   tell me how to do it.

--
View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4271930.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Ofbiz

Posted by Adrian Crum <ad...@sandglass-software.com>.
This question should be asked on the user mailing list.

The best approach is to do a find on the primary key, and if a value is 
found, return a user-friendly error message.

-Adrian

On 1/4/2012 11:04 AM, Ritesh K Kaushik wrote:
> If we enter a duplicate Primary key in Ofbiz then it gives a long error
> message, is there any way to customize those messages.
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Ofbiz-tp4260861p4260861.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.