Number field Validation

I have been working on textfield validation and received good professional help in this community. I am grateful how helpful the members are in here.

I would like to ask a quick question. I used a PHP debugger and the php aspect works fine, I just needed to set the variables differently. But I am working with numbers, not string. However the boolean appears to be not matching when I put this in CRM logic hook. 

Now I can more confused why number field validation is having problems. 

I hope someone can point me in the right direction. Thank you!

<?php

if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class number_check
{
function setNumber($bean, $event, $arguments)
{
if ($bean->phone_fax == 111)
{
$bean->phone_home = '222';
}
}
}

Parents
  • Hi JonesSmith,

    If you look at phone_fax field definition in database, it is varchar. So, you need to consider phone fields as string and your condition should be - if ($bean->phone_fax == "111").

    Let us know if this helps.

    Regards.

    Hats

  • Hi Amara Mastronardi

    Thank you for your response. I can confirm it does work, but it appears I had to do it separately from my module package. When I put it together with the other 3 logic hooks and upload this together. The CRM does not recognise this Logic Hook, which is confusing because I changed the processing index, the coding to fit correctly, cleared cache, quick fix and repair, etc. 

    It didn't pick it up since the past 8 hours I had work on it. I thought it my understanding on basic syntax on the language rather than my knowledge in CRM.

    Thanks again for your speedy response. 

Reply
  • Hi Amara Mastronardi

    Thank you for your response. I can confirm it does work, but it appears I had to do it separately from my module package. When I put it together with the other 3 logic hooks and upload this together. The CRM does not recognise this Logic Hook, which is confusing because I changed the processing index, the coding to fit correctly, cleared cache, quick fix and repair, etc. 

    It didn't pick it up since the past 8 hours I had work on it. I thought it my understanding on basic syntax on the language rather than my knowledge in CRM.

    Thanks again for your speedy response. 

Children
No Data