How to clean text with Logic Hook formula?

Hello!

Im newbie in Logic Hooks.

I want to write a Logic Hook int the Account module that clean inserted text data after saving.

In Excel I used the :

TRIM, CLEAN and PROPER functions like this:

=PROPER(TRIM(CLEAN(Text)))

The formula is removed the extra spaces and other fancy charaters, and converted the text (or name) to lowercase but the firs letter to uppercase.

How to achieve this functionality with formulas provided by Sugar. Are the formulas we can use in Logic Hook is equal with formulas we can use in Sugar Logic? If yes, than how to get this functionality?

Thanks for help!

Regards,

Arpad

Parents Reply Children
  • Hello Mehul  Bhandari

    Yes I understand that the formulas ang logic hooks are differenet.

    Simplified: one field on the record has two choices by the Studio:

    a. Entry field

    b. Calculated field (with formulas)

    Normally with entry field i cant clean or uniformise the data, only we can enter for example the text.

    We want to use the Logic Hook After Save to clean the entered text.

    We found the workoround how to define a Logic Hook.

    The Question is, to how to define the cleanin procedure :

    <?php

       if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
      
       class logic_hooks_class
       {
       function after_save_method($bean, $event, $arguments)
       {
      //logic - HOW TO DEFINE THE LOGIC? WHICH FORMULA CAN WE USE?
       }
       }

    ?>