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
Shubham Bansal 45Shubham Bansal 45 

Can we use Script or java scripts in email templates?

I have an email template and my requirement is that on my email there should be a more or less button which shows data.
When the user clicks on more the whole text should appear and when the user clicks on less then the partial text should appear.
AnudeepAnudeep (Salesforce Developers) 
Shubham - I recommend going with a formula. See this ​​​​​​example

Let me know if this helps, if it does, please close the query by marking it as solved. It may help others in the community. Thank You!
RituSharmaRituSharma
I don't think that in SF email templates, we can add Javascript to hide/show the contents based on user actions. You may think about redirecting user to a public page(community) to render the desired information.
Shubham Bansal 45Shubham Bansal 45
Hi Anudeep this formula method does not work in my case , is there any other alternative
 
RituSharmaRituSharma
Using formulas you may just control the email contents but it won't help you to show/hide the text based on user action.
Shubham Bansal 45Shubham Bansal 45
Yes Ritu Your Right and I am still stuck in this , is there any other alternative to this?
RituSharmaRituSharma
No, there is no way in SF.