Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To be alerted when new user is created
#1
Hello,

Is someone could help me creating such a workflow :
Condition : as soon as a new user is created in CRM
Action : send email to special email

Thank you

Gérald
Reply
#2
The user module does not support events nor workflows so the only way is adding your email directly. This could be an interesting coreBOS OnDemand feature, but, for the moment, you have to hard code it.


How to send an email is explained with a lot of detail in the blog and wiki. You have to add your email either here:

https://github.com/tsolucio/corebos/blob/master/modules/Users/Save.php#L190

right after the welcome email the system sends, or here:

https://github.com/tsolucio/corebos/blob/master/modules/Users/Users.php#L1152

right before the coreBOS OnDemand user log creation.

keep asking
Joe
TSolucio
Reply
#3
THank you.
I will try the first method.

Gérald

(08-21-2019, 10:18 PM)joebordes Wrote: The user module does not support events nor workflows so the only way is adding your email directly. This could be an interesting coreBOS OnDemand feature, but, for the moment, you have to hard code it.


How to send an email is explained with a lot of detail in the blog and wiki. You have to add your email either here:

https://github.com/tsolucio/corebos/blob/master/modules/Users/Save.php#L190

right after the welcome email the system sends, or here:
Reply
#4
let us know how it goes
Joe
TSolucio
Reply
#5
(08-22-2019, 09:09 AM)joebordes Wrote: let us know how it goes

Hello,

Everything is fine with this method (just after l190 in Save.php) :


Code:
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/Emails/mail.php';
$current_user = Users::getActiveAdminUser();
$to_email = 'to@somedomain.tld';
$from_name = 'Company/User name';
$from_email = 'from@yourdomain.tld';
$subject = 'Email Subject';
$content = 'Email Content';
$accountid = vtws_getEntityId('Accounts').'x74'; // 74 is an account ID in the coreBOS Tests database
$email = array(
   'saved_toid' => $to_email,
   'parent_type' => 'Accounts',
   'parent_id' => $accountid,
   'from_email' => $from_email,
   'subject' => $subject,
   'description' => $content,
);
$wsemailid = createEmailRecord($email);
list($emwsid, $emailid) = explode('x', $wsemailid);

$rdo = send_mail('HelpDesk', $to_email, $from_name, $from_email, $subject, $content, '', '', array(), $emailid);
if ($rdo != 0) {
   // Delete the $emailid record
   $focus = CRMEntity::getInstance('Emails');
   DeleteEntity('Emails', 'Emails', $focus, $emailid, $emailid);
}

Thank you.
Reply
#6
:-)
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)