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
aditya prasadaditya prasad 

How to prepopulate parent case field of a case using controller.


I have a button on case which calls a vf page and this vf will available only when some error occurs. Otherewise it directly create a child case using a controller. from action part of vf page.
But I want it should go to standard new page of a case from controller and parent case field should be populated with the casenumber from which I am trying to create a child case.

 pageRef = new PageReference ('/500/e?CFparent='+caseNumber+'&RecordType=01280000000HnUD');

I am using above code to for this. But I don't get desired result and it is being overidden by new button of case.
Any help on this.

Hi Aditya,

You got to pass parent ID value in the URL something like this :  

 parent.window.location.href ="/apex/NewLicensePageBMD?regnId={!RegistrationBMD__c.Id}

Where RegistrationBMD__c is the parent object.   I used a visual force page to implement the same. You can apply this to standard page URL as well.