Send out an email notification to all group members after a record has been added or updated. The email title comes 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.

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.

This uses the Helper library from Bizzworxx (AppGiniDetailView) to add the button.

var targetRootURL = "hooks/send_email.php?recID="; 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");

Create a target page:

$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;