+ 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.