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
MarrisMarris 

How can we pass 2 ids as query string parameter in this following e.g.?

I created a custom component as recordDisplay what they give in VF guide.

 

<apex:component>

<apex:attribute name="record" description="The type of record we are viewing."type="Object" required="true"/><apex:pageBlock title="Viewing {!record}">

<apex:detail />

</apex:pageBlock>

</apex:component>

 

Then i created a apex page as follows

 

<apex:page >

<c:recordDisplay record="Account" />

</apex:page>

 

It works fine when we pass Account id as query string.But my doubt is if we use recordDisplay for 2 times in a page for Account and Contact object then how i have to modify the code to pass 2 ids as id&cid please tell me.......Thanks 

Best Answer chosen by Admin (Salesforce Developers) 
LakshmanLakshman

Make your Componenet as:

 

<apex:component>

<apex:attribute name="recordAccount" description="The type of record we are viewing." type="Object" required="true"/>
<apex:attribute name="recordContact" description="The type of record we are viewing." type="Object" required="true"/>
<apex:pageBlock title="Viewing {!recordAccount}">
</apex:pageBlock>
<apex:pageBlock title="Viewing {!recordContact}">
</apex:pageBlock>
</apex:component>

 and Visulaforce page as:

 

<apex:page >
<c:test recordAccount="Account" recordContact="Contact"/>
</apex:page>

 Now you can view both Contact and Account.

 

Regards,

Lakshman

All Answers

LakshmanLakshman

Make your Componenet as:

 

<apex:component>

<apex:attribute name="recordAccount" description="The type of record we are viewing." type="Object" required="true"/>
<apex:attribute name="recordContact" description="The type of record we are viewing." type="Object" required="true"/>
<apex:pageBlock title="Viewing {!recordAccount}">
</apex:pageBlock>
<apex:pageBlock title="Viewing {!recordContact}">
</apex:pageBlock>
</apex:component>

 and Visulaforce page as:

 

<apex:page >
<c:test recordAccount="Account" recordContact="Contact"/>
</apex:page>

 Now you can view both Contact and Account.

 

Regards,

Lakshman

This was selected as the best answer
MarrisMarris

Thanks Lakshman