I have a custom search VF page which search on multiple criteria's like FirstName, lastname, DOB, NPI, MemberId etc. After a result is found we show two sections on the VF page, first section shows columns from Contact object and second section shows columns from CareEvent(Custom object) which is a related object to Contact.

I'm showing Carevent Id as a link which must get opened as a subtab under contact object. Can anybody tell me how to do that. getEnclosingPrimaryId is not working because no tabs are open currently. I want to use opensubtab as a solution but not sure how i will get the primary tabs id i.e Contact tab id.

1 Answer 1


In your vfp page once you click on the careEventId you will need to use openPrimaryTab to open the contact record first and then use openSubtab to open subtab under it

Sample Code:-

sforce.console.openPrimaryTab(null, '/'+contact.id, true, contact.Name, function (result) {
     console.log('openPrimaryTab result' + JSON.stringify(result));
     sforce.console.openSubtab(result.id, '/'+careevent.id, true, careevent.Name, null, function (res) {
                //do some processing

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .