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

Vf page should retrive id for the custom object and display the details of that Id

I have created a site and wrote a VF page using the contact standard object which will welcome the contactID  with first& last name.

what should i do to achieve the following tasks

If the contact ID is a member of the X Channel, show them the X Subscription Group.  It should list the Subscription based on Order within the SubscriptionGroup_Subscription associative table. Fyi, subscription and subscriptiongroup subscriptions are custom objects.

what should the code look like, any details are helpful.



This sounds like you'll need an extension controller based on the contact standard controller.


The exact solution depends on how the objects are related.  Can you clarify how:


(1) Contact is associated with channel

(2) Channel is associated with subscription group

(3) Is subscriptionGroup_Subscription a junction object (i.e. it has a lookup/master detail to both subscription group and subscription).





Thanks for the reply,


Here are the scenarios

1 channel is a field on contact

2 As of now channel is not associated with subscription group

3 Yes. subscription group_subscription is a junction object which has master detail both subscription group and subscription.


Appreciate any help


Hmm.  So how will you determine the X subscription group to be displayed if the contact is a member of X channel?  Is it based on the name or some other field?


i will link the channel to the subscriptiongroup_subscription.

Then what should be the code. pls help me, i need it.




As you have the channel id in the contact record, you should be able to use something like the following to retrieve all of the subscriptiongroup_subscription records that the channel appears in:


List<SubscriptionGroup_Subscription__c> sgs=[select id, Subscription__c, SubscriptionGroup__c from SubscriptionGroup_Subscription__c where Subscription__r.Channel__c = :contact.Channel__c];