function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
maddy27maddy27 

retrieve community url on non community triggered emails ?

how to retrieve community url on non community triggered emails ?
Best Answer chosen by maddy27
PawanKumarPawanKumar
There is no way you can populate that value  {!Community_URL} . .So i would suggest  to create Label and store the community url value there, then refer that Label to your email template.
 

All Answers

PawanKumarPawanKumar
please try below.

String ntwrkId = Network.getNetworkId();
ConnectApi.Community comm = ConnectApi.Communities.getCommunity(ntwrkId);
System.debug(comm.siteUrl);

Please mark it best if it helps you.

Regards,
Pawan Kumar
maddy27maddy27
Thanks Pawan but how can we populate the {!Community_URL} on the email template and what needs to be set in apx code? 
PawanKumarPawanKumar
There is no way you can populate that value  {!Community_URL} . .So i would suggest  to create Label and store the community url value there, then refer that Label to your email template.
 
This was selected as the best answer
maddy27maddy27
Thanks Pawan , makes sense to go with label.
Cheers!
PawanKumarPawanKumar
Please mark it best if you think it was useful. Thanks.