Page 2 of 2
Re: email template
Posted: Mon Sep 15, 2025 10:02 am
by kev1n
I also fixed the "Update User AS" SQL.
Re: email template
Posted: Mon Sep 15, 2025 10:09 am
by sietwolt
Thanks. Both updates done. Looking forward to your further instructions.
Han
Re: email template
Posted: Mon Sep 15, 2025 10:14 am
by kev1n
Next step: Verify that a welcome email is sent when a new user is created.
Re: email template
Posted: Mon Sep 15, 2025 10:21 am
by sietwolt
Thanks!! A welcome email is sent now. Great !! Best to delete the old nuwelcome email templates?
Can i now set a welcome email to a category of users ( which field in the new user addition?)
Re: email template
Posted: Mon Sep 15, 2025 10:33 am
by kev1n
Now you can set up your different welcome email templates.
1. Open the template
nu_send_welcome_email_template
and click
Clone
.
2. Enter a code (e.g.
send_welcome_email
) and set a group (e.g.
manager
).
3. Modify the subject, body, etc., and save the template.
Next, repeat the process for another group:
1. Open the template
nu_send_welcome_email_template
again and click
Clone
.
2. Enter a code (e.g.
send_welcome_email
— either the same as in step 1 or a different one) and set a group (e.g.
sales
).
3. Modify the subject, body, etc., and save the template.
Note: To allow multiple templates with the same code, run this SQL update first:
Code: Select all
UPDATE zzzzsys_object
SET sob_all_validate = 1
WHERE zzzzsys_object_id = 'nu635294e972f5f54';
Old welcome templates can be deleted if they are no longer required.
Next instructions will follow when done

Re: email template
Posted: Mon Sep 15, 2025 10:45 am
by sietwolt
Ok . Changes and sql done. Waiting for your next instructions
Re: email template
Posted: Mon Sep 15, 2025 10:52 am
by kev1n
The last step is to create your own "Send Welcome email" procedure.
1. Open the Procedure template
nu_send_welcome_email_template
.
2. Click
Clone
(the
code
field will automatically change to
nu_send_welcome_email
).
3. Overwrite the existing code by pasting the code below and adapt the code to use your ids etc.
Code: Select all
// Retrieve Information about the user
$user = nuUserSavedInfo();
$accessLevelId = $user["access_level_id"];
// Decide which template to use based on access level
// <<<<<<<< Use your access level ids, template name and group names <<<<<<<<<<<<<<<<<<<<<<<
switch ($accessLevelId) {
case '2660a0de8f28a50': // Manager access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'manager'); // E.g. "manager" is what you entered in the group field
break;
case '2660a0de8f28a52': // sales access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'sales');
break;
default: // Fallback (if access level not recognized)
$template = nuGetEmailTemplateData("send_welcome_email", '', 'default');
break;
}
if ($template == false) {
nuDisplayError('Unknown email template!');
return;
}
$sendResult = sendEmailFromTemplate($template);
if ($sendResult[0] != true) {
nuDisplayError($sendResult[1].'<br>'.$sendResult[2]);
}
// Sends an email message using an email template.
function sendEmailFromTemplate($template) {
$body = str_replace('#'.'NUBUILDER_URL'.'#', nuGetHttpOrigin() , $template['body']);
$params = array(
'to' => $template['to'],
'cc' => $template['cc'],
'bcc' => $template['bcc'],
'body' => nl2br($body),
'subject' => $template['subject']
);
// Replace all Hash Cookies
foreach ($params as $key => $value) {
$params[$key] = nuReplaceHashVariables($value);
}
return nuSendEmail($params);
}
4. Save it
The corresponding access level IDs can be retrieved as follows:
1. Open an access level.
2. Press
Ctrl+Shift+M
(or go to
Options Menu - Form Info
).
3. The displayed
Record ID
is the access level ID.
Re: email template
Posted: Mon Sep 15, 2025 4:09 pm
by sietwolt
Great thanks for the help. Excuses my ignorance: how can i combine a new user and a specific welcome email using the recordID
Re: email template
Posted: Mon Sep 15, 2025 4:14 pm
by kev1n
Can you elaborate a bit? I don’t quite understand what you mean by combining a new user and a welcome email with the recordID
Re: email template
Posted: Mon Sep 15, 2025 5:04 pm
by sietwolt
I'll try.
In emailtemplates is a field " category". I thought that adding an user it would be possible in that userform to fill in also the categoryname in a field and that as a consequence for the new user the intended welcome-email would be send
-----------------------------------------------------------------------------------------------
According your instructions: the recordID of the accesslevel 'vrijwilliger' = 67e3ff43a45adc2.
In the cloned emailtemplate I adjusted the code with this accesslevel as follows:
case '67e3ff43a45adc2': // vrijwilliger access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'vrijwilliger'); // E.g. "vrijwilliger" is what you entered in the group field
break;
The name 'vrijwilliger' entered in the group field.
Entering a new user as 'vrijwilliger' results not in the adjusted template.
What am I doing wrong?