+ Start a Discussion
Stefaan Somers 12Stefaan Somers 12 

Call visualforce page from utilitybar with record-id

I have an existing visualforce page, with a custom controller.
In the apex-code I'm using 
ApexPages.currentPage().getParameters().get('id')];

Now I'm calling this same VF page from the Utility-bar. Unfortunateley it doesn't have the context of the record-id.

How can I resolve the easiest way, so I can maintain most of the logic of the VF page?
VinayVinay (Salesforce Developers) 
Hi Stefaan,

Try below snippet.
 
posId=apexpages().currentpage().getparameters().get('id');
public PageReference saveAndReject() {

PageReference requestPage = new pagereference('/apex/pagename?id='+posid);
return requestpage;

}

Review below links which has working examples.

https://ericsplayground.wordpress.com/2019/02/24/load-a-visualforce-page-with-parameters-in-lightning/
https://rajvakati.com/2018/10/21/using-page-context-in-the-utility-bar-api/
https://developer.salesforce.com/forums/?id=906F0000000kK7TIAU
https://developer.salesforce.com/forums/?id=906F000000090r9IAA

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
firdoss mohd 1firdoss mohd 1
Hi Stefaan,

It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!

https://jbshelpdesk.secure.force.com

Thanks,
Jarvis SFDC team
Stefaan Somers 12Stefaan Somers 12
Hi Vinay, where should this code be located? In a Lightning component itself??
VinayVinay (Salesforce Developers) 
Hi Stefaan,

In controller,  Review above sample example links as well which can help and give you more information.

Thanks,
Vinay Kumar