Preview:
void Indent.Indent_Email_Notification(int myindent_ID)
{
	myindent = Indent[ID == myindent_ID];
	myindent_itemdetails = Indent_Sub_Form[Indent_Form_RECID == myindent_ID];
	getindentor = Employee_Details[ID == myindent.Request_Raised_By];
	emailto = getindentor.Employee_Email;
	getemail = Email_Template[Template_No == 4];
	sub = getemail.Subject_field;
	body = getemail.Body;
	sub = sub.replaceAll("{prno}",myindent.Indent_No,true);
	sub = sub.replaceAll("{prstatus}",myindent.Approval_Status,true);
	body = body.replaceAll("{prno}",myindent.Indent_No,true);
	body = body.replaceAll("{prdate}",myindent.Indent_Request_Date.tostring("d-MMM-yyyy"),true);
	body = body.replaceAll("{prstatus}",myindent.Approval_Status,true);
	body = body.replaceAll("{indentor}",getindentor.Employee_Name,true);
	if(myindent.Project_Name != null)
	{
		project = "The indent was placed for the project " + myindent.Project_Name.Project_Number + " - " + myindent.Project_Name.Project_Title;
	}
	else
	{
		project = null;
	}
	body = body.replaceAll("{project}",ifnull(project,""),true);
	IndentLink = "<a href='https://creatorapp.zoho.in/carrierwheels/erp#Report:All_Indents?Indent_No=" + myindent.Indent_No + "' title='Click to Open Indent' target='_blank'>Click to Open Indent " + myindent.Indent_No + "</a>";
	body = body.replaceAll("{link}",IndentLink,true);
	tab = "<html><style>th,td {padding: 5px;}</style><table border = 1> <th>S. No.</th> <th>Part No.</th> <th>Part Description</th> <th>Specification</th> <th>Required Qty</th><th>UOM</th> <th>Remarks</th> <th>Purpose of Indent</th>";
	count = 1;
	for each  tablerec in myindent_itemdetails
	{
		getuom = Unit_of_Measurement[ID == tablerec.UoM].UOM;
		tab = tab + "<tr><td>" + count + "</td>";
		tab = tab + "<td>" + tablerec.Part_No.Part_No + "</td>";
		tab = tab + "<td>" + tablerec.Part_Description.Part_Description + "</td>";
		tab = tab + "<td>" + ifnull(tablerec.Specification,"") + "</td>";
		tab = tab + "<td>" + ifnull(tablerec.Required_Qty,0) + "</td>";
		tab = tab + "<td>" + getuom + "</td>";
		tab = tab + "<td>" + ifNull(tablerec.Remarks,"") + "</td>";
		tab = tab + "<td>" + ifnull(tablerec.Purpose_of_Indent,"") + "</td></tr>";
		count = count + 1;
	}
	tab = tab + "</table></html>";
	body = body.replaceAll("{table}",tab,true);
	//info body;
	sendmail
	[
		from :"CWPL ERP <erp@carrierwheels.com>"
		to :emailto
		reply to :"sourcing@carrierwheels.com"
		subject :sub
		message :body
	]
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter