Hi have a Custom lookup field[Related Account] which is made read only on the page layout.I need to prepopulate the value of the field[Related Account].Can you please help me.

If the field[related Account] is not marked as read only n the page layout,it is achievable by URL Hacking succesfully.

  • If you are not Ok with Apex, then you can use Flows else Apex trigger.
    – Mahmood
    Feb 20, 2019 at 6:18
  • I need to prepopulate the value of the read only field when I am trying to create the new record. On click of new button can we prepopulate a read only field? Please note the standard new button is overridden by a VF Page where I am redirecting to the URL and prepopulating the value using URL Hacking.
    – MG93
    Feb 20, 2019 at 6:24

3 Answers 3


I don't think its possible. For what you want to achieve you need custom JS. Where you will append the value in existing HTML. It is not possible with URLhavking only.

The only thing you can do here is override the edit page with custom page/component and there show the field value.


Why don't you just create a New Action and predefine its fields?

It can be done on most of the objects; just choose Buttons, Links and Actions from the sidebar and create a new one.


I had the limitation of not creating a new VF or any other component hence came with the below workaround.

I was able to achieve this by making a validation rule on the field. Case 1 - while record is created - ISNEW() - checking if the field is same as what it was set dynamically in url hacking case 2 - when record is edited - NOT(ISNEW()) - checking if the field is changed.

It will restrict the user from editing it and will somewhat serve the purpose of read only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.