Monday, 27 May 2013

Get date plus or minus today

Greetings from Urdhva Tech!!

Several times I have came across same requirement of getting few days back from today, or few days after today. SugarCRM comes with few very handy date utility functions, and there is one which does the job!

global $timedate;
$today = $timedate->getInstance()->nowDbDate(); // Today
$earlier = $timedate->asDbDate($timedate->getNow()->modify("-30 days")); // 30 days before!
$later = $timedate->asDbDate($timedate->getNow()->modify("+2 months")); // 2 months later!

echo "Today:".$today;
echo "<br />30 days before:".$earlier;
echo "<br />2 months later:".$later;

Simple! Isn't it?

Take a look at include/TimeDate.php for many other suitable date time functions.

Comments are welcome!

Follow us on Twitter @urdhvatech

Glimpse of our plug-ins & products.

Monday, 20 May 2013

Check list to send Email Campaigns from SugarCRM

Greetings from Urdhva Tech!

Today I came across very famous head scratching issue of "Email Campaigns sent out from SugarCRM Not working!!"

Once I did it for a client and did a smart save of the steps I performed! Voila!!

Check 1 : You have to set up Campaign email from Campaigns > Set up Email. It will take a little time to test the configuration. (Not from Admin panel)

Check 2 : You need to confirm whether the cron job is set up correctly on server and running timely.

Check 3 : You should have valid Campaign, which has status = Active, Type = Email. Campaign should have Email marketing set up(It has to set up exactly at hours you want to send email at) for the targeted Target List.

Check 4 : Target List should not be of type "Test".

Check 5 : Go to Campaign and Press Send Emails. And follow till end, which will queue up emails and then cron job will do the task.

Drop comments, they are precious for us!

Follow us on twitter: @Urdhvatech

Contact us at for any services related to SugarCRM.

Thursday, 2 May 2013

Accessing PHP variable in .tpl


Sometimes situation may arise when you want some PHP code in tpl. Following piece of code will show how to achieve this.

    global $current_user;
    $this->_tpl_vars['current_user_email'] = $current_user->email1;

Now use 'current_user_email' variable as follows in tpl.

<input type="text" id = "current_user_email" name="current_user_email" value='{$current_user_email}'>

Hope it helps.

Feel free to leave your comments.
Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My photo
SugarCRM Consultants Contact us at Skype : urdhvatech

Search This Blog

Stay connected Socially


Total Pageviews

Popular Posts