Email with pointer to record id

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
utony
Veteran Member
Posts: 109
Joined: 2020-04-03 18:37

Email with pointer to record id

Post by utony » 2024-07-25 21:27

I am trying to figure this out and keep striking out.

I want to send email to a set of user upon status change, no problem got that. But I want to send the users to record that was updated. How do I create a lick that sends a user to the record ID?

my Primary key is = 'Close_Patrol_ID'

current code
[/b]

Code: Select all


$tn = 'Close_Patrol'; 
	$cn = 'Report_Status'; 
	
	$pk_cn = getPKFieldName($tn);
	$pk = $data[$pk_cn];
	$data_current = getRecord($tn, $pk);

	if ($data[$cn] == 'Closed') {

	sendmail([
			'to' => 'email address here',
			'cc' => '',
			'subject' => 'Close Patrol Report Closed',          
			'message' => 'This is where I need the message to go with the direct link to the record that was closed'
		          
	]);
	}

User need to log in to see the record as well. Any help would be great!

I saw this post, but it did not help.

https://bigprof.com/appgini/tips-and-tu ... ed-records

utony
Veteran Member
Posts: 109
Joined: 2020-04-03 18:37

Re: Email with pointer to record id

Post by utony » 2024-07-25 21:28

Additionall, if I want the email to have all the data point in it, rather than displaying a link. what is the structure for that?

utony
Veteran Member
Posts: 109
Joined: 2020-04-03 18:37

Re: Email with pointer to record id

Post by utony » 2024-07-25 21:30

here are my data fields.


"`Close_Patrol`.`Close_Patrol_ID`" => "Close Patrol ID",
"`Close_Patrol`.`Report_Status`" => "Report Status",
"`Close_Patrol`.`Sector`" => "Sector",
"`Close_Patrol`.`Incident_Number`" => "Incident Number",
"`Close_Patrol`.`Date_Recieved`" => "Date Recieved",
"`Close_Patrol`.`Received_By`" => "Received By",
"`Close_Patrol`.`Street_Number`" => "Street Number",
"IF( CHAR_LENGTH(`streets1`.`street_names`), CONCAT_WS('', `streets1`.`street_names`), '') /* Street */" => "Street",
"`Close_Patrol`.`Reason`" => "Reason",
"`Close_Patrol`.`Effective_Date`" => "Effective Date",
"`Close_Patrol`.`Time_From`" => "Time From",
"`Close_Patrol`.`Time_To`" => "Time To",
"`Close_Patrol`.`Expiration_Date`" => "Expiration Date",
"`Close_Patrol`.`Extended_Expiration`" => "Extended Expiration",
"`Close_Patrol`.`Extended_By`" => "Extended By",
"`Close_Patrol`.`Reporting_Party_Name`" => "Reporting Party Name",
"`Close_Patrol`.`Reporting_Party_Address`" => "Reporting Party Address",
"`Close_Patrol`.`Reporting_Party_Phone`" => "Reporting Party Phone",
"`Close_Patrol`.`Supervisor_Approving_Close_Patrol`" => "Supervisor Approving Close Patrol",
"`Close_Patrol`.`General_Document`" => "General Document",
"`Close_Patrol`.`Finalizing_Officer`" => "Finalizing Officer",
"`Close_Patrol`.`Date_Report_Finalized`" => "Date Report Finalized",
"`Close_Patrol`.`Ending_Incident_Number`" => "Ending Incident Number",
"`Close_Patrol`.`Ending_Remarks`" => "Ending Remarks",
"`Close_Patrol`.`Releasing_Supervisor`" => "Releasing Supervisor",
"`Close_Patrol`.`Record_Created_By`" => "Record Created By",
"`Close_Patrol`.`Record_Edited_By`" => "Record Edited By",

User avatar
zibrahim
Veteran Member
Posts: 154
Joined: 2020-01-28 18:30
Location: Malaysia

Re: Email with pointer to record id

Post by zibrahim » 2024-07-26 10:08

Hi there,
for the link in the email, try this.

Code: Select all

$tn = 'Close_Patrol';
$cn = 'Report_Status';

$pk_cn = getPKFieldName($tn);
$pk = $data[$pk_cn];
$data_current = getRecord($tn, $pk);
$url = "https://YOURDOMAIN.COM/Close_Patrol_view.php?SelectedID=" . $data['Close_Patrol_ID'];

if ($data[$cn] == 'Closed') {

	sendmail([
		'to' => 'email address here',
		'cc' => '',
		'subject' => "Close Patrol Report Closed",
		'message' => "This is the direct link to the record that was closed. <br> $url"

	]);
}
Zala.
Appgini 24.17, MacOS 14.6 Windows 11 on Parallels.

utony
Veteran Member
Posts: 109
Joined: 2020-04-03 18:37

Re: Email with pointer to record id

Post by utony » 2024-07-27 16:04

It works great! Thank you!.

One follow up question though. So on phone email you can click the link but in desktop email - the email displays link but it is not clickable. Any idea?

Post Reply