CoreBOSBB
[solve] Validation with Business Map - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8)
+--- Thread: [solve] Validation with Business Map (/showthread.php?tid=892)

Pages: 1 2


[solve] Validation with Business Map - rslemer - 02-12-2018

I did try understand how I can implement,  this important resource in coreBOS.

I try created 4 business map in demo online, at leads module

1) Checked a pick list not use a default value

<map>
 <originmodule>
   <originname>leads</originname>
 </originmodule>
 <fields>
   <field>
     <fieldname>leadsource</fieldname>
     <validations>
       <validation>
         <rule>notIn</rule>
         <restrictions>
         <restriction>--None--</restriction>
         </restrictions>
       </validation>
     </validations>
   </field>
</map>

2) Checked a phone number is only numeric

<map>
 <originmodule>
   <originname>leads</originname>
 </originmodule>
 <fields>
   <field>
     <fieldname>phone</fieldname>
     <validations>
       <validation>
         <rule>numeric</rule>
         <restrictions>
         <restriction></restriction>
         </restrictions>
       </validation>
     </validations>
   </field>
</map>

3) Checked a new date field, is after a date of modified

<map>
 <originmodule>
   <originname>leads</originname>
 </originmodule>
 <fields>
   <field>
     <fieldname>cf_846</fieldname>
     <validations>
       <validation>
         <rule>dateAfter</rule>
         <restrictions>
         <restriction>{{modifiedtime}}</restriction>
         </restrictions>
       </validation>
     </validations>
   </field>
</map>

4) Checked is a new custom field, not duplicated in data base

<map>
 <originmodule>
   <originname>leads</originname>
 </originmodule>
 <fields>
   <field>
     <fieldname>cf_847</fieldname>
     <validations>
       <validation>
         <rule>notDuplicate</rule>
         <restrictions>
         <restriction></restriction>
         </restrictions>
       </validation>
     </validations>
   </field>
</map>

But not working.

I did try read documentation again, and duplicated a demo business map, but not successful.

What I do wrong?


RE: Validation with Business Map - joebordes - 02-12-2018

The first thing I do when an XML map does not work is pass it through a validation:

https://www.xmlvalidation.com

I just tried your first map: check_leadsource and got this error:

17: 3 The element type "fields" must be terminated by the matching end-tag "</fields>".

I added that and it worked


RE: Validation with Business Map - joebordes - 02-12-2018

The other ones seem to have the same problem. Please try fixing those yourself and let me know how it goes.


RE: Validation with Business Map - rslemer - 02-12-2018

Yes, I correct and all business map works fine!

By the way, the mistake in the example, in doc page ... Sad

"..."
The other is using business map validations: http://corebos.org/documentation/doku.php?id=en:adminmanual:businessmappings:validations
Look at the cbCalendar activitytype example
"..."

And I think better ideia, post a link for xml validade too.


RE: Validation with Business Map - joebordes - 02-12-2018

I fixed the documentation error: thanks!

and added a comment on the validator:

http://corebos.org/documentation/doku.php?id=en:adminmanual:businessmappings#types_of_business_mappings


RE: Validation with Business Map - rslemer - 02-13-2018

Leadsource system translate right to pt_br, but industry not ...

and how i can get a test more complex, for example, if country is setting to Brazil test a valid phone format in Brazil, but if not Brazil, test a valid format number for international number

And another good tool is a regex validator http://tools.lymas.com.br/regexp_br.php#

In item 3 I wish follow up not in past. There any special function or word to do that?

I try use a datemodified but not working ( I think is different format too )


RE: Validation with Business Map - joebordes - 02-13-2018

=> translation: I could not reproduce, it is working correctly for me

=> use a custom validation script

=> regexp are already supported

=> try with dateBefore/dateAfter


RE: Validation with Business Map - rslemer - 02-13-2018

@ => try with dateBefore/dateAfter

but how I set dateAfter today?

=> regexp are already supported

ok, I know, I suggest a validation site, only for testing proposes


RE: Validation with Business Map - rslemer - 02-13-2018

I need two more examples

1) For I set a mandatory field, testing a value of another field - example - two custom fields, if client wish a financial for project, CNPJ ( vat number in Brazil ) is mandatory

2) Set a regex different, when testing another filed - example, regex for Brazilian phone, if country is Brazil


RE: Validation with Business Map - rslemer - 02-20-2018

But the message shown in error case, not is translated for me.

This message in correct language for you, too