I'm trying to load a field via a url on custom button. I don't want the user to be able to view or change it (read only). If I remove it from the page layout or make it read-only, The field won't load. If I put it on the page, the field will load but they can modify it. Is it possible to load the field without putting it on the page layout?
2 Answers
Sounds like you are trying to use a URL hack to set a field value. One option would be to use a picklist and set the default picklist value at the record type level. In your URL hack you could send the appropriate record type id and auto-populate the drop down. The field can be Read-Only on the page layout if you use this method. If you try to directly set a read-only field via a URL hack it will fail. Setting your values and using a record type can get around that limitation. The field still needs to be included in the page layout.
For example:
https://[Org Instance]/[sObject Prefix]/e?retURL=%2F[Record Id]&saveURL=%2F[Record Id]&RecordType=[Record Type Id]
No. It's possible to load the field when it's not on the page layout. If it's not in page layout and using the field ID won't populate the fields as it's not in HTML and browser won't get Id to assign the value.. if you don't want field on the layout why don't you go with the other option like workflow, trigger or other field update methods..