Salesforce: Add knowledge article link in the email template.

 I have resolved with Visualforce email template. Use outputLink with below example.

<messaging:emailTemplate subject=" A Knowledge Article " recipientType="User" relatedToType="Knowledge__kav">

<messaging:htmlEmailBody >


Article Id: {!relatedTo.UrlName}<br/>

Article Title: {!relatedTo.Title}<br/>


Link to Article: <apex:outputLink value="{!LEFT($Api.Partner_Server_URL_140,FIND('.com',$Api.Partner_Server_URL_140)+4)+'/lightning/articles/Knowledge/'+RelatedTo.UrlName}" > Click Here </apex:outputLink>

<br/>


</messaging:htmlEmailBody>

</messaging:emailTemplate>

 

Result:https://a8--dv8.lightning.force.com/lightning/r/Knowledge__kav/ka07b000000HDy5HHG/view

 

Hope this solution works for everyone.

Comments