My clients are required to use their internal outlook programs for sending e-mails, so using the existing e-mail format provided by Scriptcase is not what I can do. They have requested the ability to select multiple e-mail addresses from my system and have a button to load all of those selected e-mail addresses into outlook to send their e-mail. It should work just like the mailto command, only load multiple e-mail addresses instead of just the one it currently loads. I can get my grid to show the data, select the data, but for the life of me I can’t get an array to work to implode the selected data fields. I have deleted my attempts and am starting fresh. Would any of my fellow coders be able help a gal out? Thanks!
if GROUP_CONCAT is available with your database
$sql = "SELECT GROUP_CONCAT(email ORDER BY email SEPARATOR ',') as emails FROM table WHERE condition";
sc_lookup(rs, $sql);
if (isset({rs[0][0]})) {
$emails = explode(',',{rs[0][0]},-1);
}
What kind of flow do you actually want?
I can give you this code, for example:
In the grid, create a button for select multiple emails to send
Run grid
Select multiple emails to send
Run button and create array
and then?
send array to?
I tried to do this and send an array of selected emails to the control app.
And the control app is just one field - selected_emails
So what now?
From this point I can only make a copy / paste selected field
and paste to outlook.
Or do you have something else in mind.
Let me know to post the code.
Correction:
If we specify the type of the selected_emails field = email
clicking on the icon will open the default mail program and enter the email addresses.
Is this what you want?
Yes rik! This is exactly what I was trying to do! Thank you so much for helping! How did you do it?
"Correction:
If we specify the type of the selected_emails field = email
clicking on the icon will open the default mail program and enter the email addresses."
Thank you for your help! I’ll give it a try!
Ok let’s go step by step:
// Grid start ****************************************************************************************************************
Open your grid and create an event in onScriptInit and enter:
[selected] = array(); //initialize the array where you collect the selected rows. Set to OUT in application/global variable.
Go to Buttons and create a new button - type RUN with a name for example:
send_multiple_emails
Configure the layout of the button as desired and enter in OnRecord:
[selected][] = {email}; // The name of your email field
Change button view to OnFinish and enter:
if (count ([selected])> 0)
{
$var_email_to = implode (’,’, [selected]);
sc_redir(selected_emails.php, selected_emails = $var_email_to, “_parent”);
}
Save grid and edit Global Variable settings:
selected = Out
// Grid end ******************************************************************************************************************
Create new Control app with name selected_emails
Create one field: selected_emails with Data Type E-mail
Create onLoad Events and type:
{selected_emails} = [selected_emails];
Check Global Variable settings. Must be IN
// ******************************************************************
Generate both applications and run grid
Clicking on the envelope icon should open the local default mail program and e-mail addresses must already be entered.
Pictures of all the steps are attached below.
Rik thank you so very much for you help!! That’s amazing! Outstanding work! I was able to re-create it and it works great. Thank you again!!
I’m glad I was able to help.