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
NagothiNagothi 

VF page to Case Default Page Layout Query String Issue

Hi,

    My current flow is as follows

    1) User clicks a button from Account Page Layout --> it lands on Custom VF Page 

    2) User clicks a button on VF page --> it will land on Case Page

   

     Issue: I need to auto fill Case custom field "ParentName" and standard field "Subject" (cas14) on Case Page Layout

 

My current custom controller code

 

public PageReference test(){
 PageReference hierarchyChangeCasePage;
 String myRecId = ApexPages.currentPage().getParameters().get('Id');
 String curPgURL = ApexPages.currentPage().getURL();

hierarchyChangeCasePage = new PageReference('/500/e?def_account_id='+myRecId+'&cas14=My Custom Subject&ent=Case&00NP0000000XF3z='+parentName+'&RecordType='+selectedHierarchyValue+'&nooverride=1');    

return hierarchyChangeCasePage.setRedirect(true);

}                                        

 In my debug logs, i dont see cas14 and  00NP0000000XF3z are passed to Case Page Layout in URL Query String.

Can anyone pl. help me how to autofill Case fields from a VF page?

 

Thanks

Mallesh

 

sfdcfoxsfdcfox

Technically, I don't see why that code should fail, but I'd recommend using parameters:

 

hierarchyChangeCasePage = new PageReference('/500/e');
hierarchyChangeCasePage.getParameters().putAll(
  new Map<String,String> {
    'def_account_id' => myRecId,
    'cas14' => 'My Custom Subject',
    'ent' => 'Case',
    '00NP0000000XF3z' => parentName,
    'RecordType' => selectedHeirarchyValue,
    'nooverride' => '1'
  }
);
hierarchyChangeCasePage.setRedirect(true);
return heirarchyChangeCasePage;

You may also have a problem if the record type parameter is acting up; it's entirely possible that the user is landing on the record type selection page first, which tends to eat parameters.