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
Pat WimsattPat Wimsatt 

Hide Fields on a template

Is it possible to hide fields on a template?  Perhaps by using javascript?  I am new to the Salesforce platform but I know it can be done in Dynamics so I understand the concept.  Based on some condition a field's visibility property is either turned on or turned off. 
 
Best Answer chosen by Pat Wimsatt
VinayVinay (Salesforce Developers) 
No this is not possible.  However, you can control field-level access using Field level security,  Else you can use record type and assign different layouts to different profiles.

https://help.salesforce.com/articleView?id=customize_recordtype.htm&type=5
https://trailhead.salesforce.com/content/learn/projects/customize-a-salesforce-object/create-record-types

Hope this helps...

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Pat,

No using javascript this might not be possible.

Check below links for other way.

https://developer.salesforce.com/forums/?id=906F0000000AyyPIAS
https://trailblazers.salesforce.com/answers?id=9063A000000e2x2QAA

Thanks,
Pat WimsattPat Wimsatt
Sorry, my question was not clear.  I am working with a Page Layout, not an email template. I want to hide a field on a page layout.  
 
VinayVinay (Salesforce Developers) 
No this is not possible.  However, you can control field-level access using Field level security,  Else you can use record type and assign different layouts to different profiles.

https://help.salesforce.com/articleView?id=customize_recordtype.htm&type=5
https://trailhead.salesforce.com/content/learn/projects/customize-a-salesforce-object/create-record-types

Hope this helps...

Thanks,
This was selected as the best answer
vishal-negandhivishal-negandhi
Hi Pat, 


If you're using salesforce lightning, then have a look at Dynamic forms - https://admin.salesforce.com/blog/2019/break-up-your-record-details-with-dynamic-forms
It does allow you to do what you intend to. 


Hope this helps!