Friday, 11 October 2013

x happens only for new records

Greetings from Urdhva Tech!

Thank you to people submitting "how to topics".

Q: How to make a field mandatory only if creating a record?

Lets do this,

For example lets make "Office phone" required in Accounts module.

Step 1: Create / Edit (if exists at modules/Accounts/views/view.edit.php, copy over) custom/modules/Accounts/views/view.edit.php

And have following code in function display.

function display() {
        global $mod_strings;
        $jsscript = <<<EOQ
        <script>
                addToValidate('EditView','phone_office','varchar',true,'{$mod_strings['LBL_PHONE_OFFICE']}');    // mark office phone field required
                $('#phone_office_label').html('{$mod_strings['LBL_PHONE_OFFICE']} <font color="red">*</font>'); // with red * sign next to label
        </script>
EOQ;
        parent::display();
       
if(empty($this->bean->fetched_row['id'])) // This makes sure, current action is not "edit"
            echo $jsscript; //echo the script
    }

Voila! Done!


[Loved how screen looks than what you have? Buy the look!] 

Highlight:

if(empty($this->bean->fetched_row['id'])) is the key! Do something ONLY for new records!


Hope that helps! Post comment below.

Keep posting how-to topics! Excited to start off with first how to on request!

Related: Required conditionally if dropdown X has value Y.

Wednesday, 2 October 2013

SugarCRM functional tour - Admin - The King - IV

Greetings from Urdhva Tech!

Thank you for following the Tour. In case you landed up directly to this page, following is the Index.

3. Admin - The King - II
4. Admin - The King - III
5. Admin - The King - IV
6. .. Coming soon ..

This article will concentrate on features available in Community Edition(v6.5.15). Stay tuned for PRO+ features for Admin.

Lets continue System section


[Loved how screen looks than what you have? Buy the look!]

Currencies

Admin > System section > Currencies

SugarCRM comes up with international currency support. Here you can introduce currencies you deal with in your business. Give abbreviation, symbol and conversion ratio. You can deactivate a currency too. This is system wide settings. AFAIK, the conversion ratio is not live.

Backups

Admin > System section > Backups 

This is what you would do on periodic basis, and when you are doing upgrades. It is advisable to perform backup before you install any third party tool, which has un-upgrade safe(which means the package overwrites core files to fulfill its functionality) changes.

It asks for two parameters, where you want to store the backup and what the backup file should be named. P.S. Here you have to provide file name with extension .zip

[Loved how screen looks than what you have? Buy the look!]

Languages

Admin > System section > Languages
With SugarCRM CE comes only one language US English. So, for language support you have to go to SugarForge and get desired language pack and install it through Module Loader.

From here, you can activate or deactivate set of languages for your SugarCRM Users.

Repair

Ask a SugarCRM developer how magical and important this part is!!
Whenever you find something awkward in your SugarCRM instance, first thing you would do is, 

Admin > System section > Repair > Quick Repair and Rebuild

99% of issues will be resolved by this magical link. It removes cached files of views from cache. Rebuilds Extensions, Logic hooks, Menus, Vardefs, Utils, Relationships, ... and list goes on. It checks in database for any missing table or field, if found, shows you a query, you verify and press Execute button and see the magic!

Repair has many other separate options, like Repair Roles, Rebuild Sugar Dashlets, Repair Relationships, and so on.

Special mention:
> You can enable/disable seed users, which you may have created through demo data while initial installation.

> You can delete files which failed to removed when you removed a related record to it. It is a clean up process, so takes a little time. Be patient!

 [Loved how screen looks than what you have? Buy the look!]

Stay tuned for next article. Subscribe now to get updates of this series right in your INBOX.
Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My photo
SugarCRM Consultants Contact us at contact@urdhva-tech.com Skype : urdhvatech

Search This Blog

Stay connected Socially

     

Total Pageviews

Popular Posts