Hello
I need to send out an email notification to all group members after a record has been added or updated.
The email title needs to come from a field from a table.
When notification is receive, if user clic on the title, it redirect user to the added record after user login.
Thank for any help
Email notification to all group members
Re: Email notification to all group members
Hi,
That sounds a lot like you want to add something in the tablename_after_insert and tablename_after_update hooks. In the hook, you do your select from the table that has your subject. The body of the email would have the hyperlink to the added record.
I added a button on a table dv page to redirect to another page (php file) that does all the work. A trick at that point is that I pass the current record in the querystring to that page. This uses the Helper library from Bizzworxx (AppGiniDetailView) to add the button.
In the target page, I have
I ended up using php to send the email. I think there is an API in AG to do that, probably cleaner, but I had already done this.
I needed to do the button. You can add this directly in the hook I would think, simpler, not having to mess with the button part or the querystring part.
Good luck.
~Paul
That sounds a lot like you want to add something in the tablename_after_insert and tablename_after_update hooks. In the hook, you do your select from the table that has your subject. The body of the email would have the hyperlink to the added record.
I added a button on a table dv page to redirect to another page (php file) that does all the work. A trick at that point is that I pass the current record in the querystring to that page. This uses the Helper library from Bizzworxx (AppGiniDetailView) to add the button.
Code: Select all
var targetRootURL = "hooks/send_email.php?recID=";
var targetURL = targetRootURL.concat($j( 'input[name=SelectedID]' ).val()); // This adds the current record ID to the querystring
var dv = new AppGiniDetailView();
var actionbuttons = dv.actionbuttons;
var group = actionbuttons.addGroup("Actions");
group.addLink("Send Tow Request", targetURL, Variation.Primary, "send");
Code: Select all
$recID = $_GET['recID']; // This reads in the current record ID from the querystring
$form_id = sqlvalue("SELECT id FROM Tablename WHERE id = '{$recID}'"); // This gets data for the current record
// I store the root URL of our home page in a table, we need that for the link in the body
$home = sqlvalue("SELECT Home FROM ConfigKeys LIMIT 1");
// This builds the email header
$to = sqlvalue("SELECT Request_To FROM ConfigKeys LIMIT 1");
$from = sqlvalue("SELECT Request_From FROM ConfigKeys LIMIT 1");
$subject = sqlvalue("SELECT Request_Subject FROM ConfigKeys LIMIT 1")." - ".$recID;
// This builds the body with the link to the record
$body = sqlvalue("SELECT Request_Body FROM ConfigKeys LIMIT 1").
$lf.$lf.$record.
$lf.$lf."To view this record please go to: ".$lf.
$home.
"Tablename_view.php?SelectedID=$recID".$lf;
I needed to do the button. You can add this directly in the hook I would think, simpler, not having to mess with the button part or the querystring part.
Good luck.
~Paul
Re: Email notification to all group members
Hello Paul
Thank you for your help, I have the library and I am going to try.
Best regards
Thank you for your help, I have the library and I am going to try.
Best regards