+ Start a Discussion
bakul.patelbakul.patel 

Name link to custom VF page

Hi,

I have a VF page for custom object, which is parent object to many other children objects.

These children objects have lookup field to parent object.

So, there when child record is created, name of parent record appears on the page layout.

When you click on that link, it takes you to standard layout of the parent object. Instead of that, I want to take user to custom VF page that we have developed for parent object.

 

Can anybody tell me how to do that?

 

Thanks,

Bakul

PremanathPremanath

May be Vf page we can't achive this thing.

But we can write one trigger for your requirement. Like this

 

There is a lookup field called spouse on to contact.(self lookup). 

Here if a contact record name='Daniel'.

And spouse in the record of daniel is 'Mary'.

if i click mary lookup feild the daniel should be the spouse in the mary record.

it means the lookup value should change vice versa.

 

trigger MatchSpouse on Contact (after insert, before update) {
    List<Contact> spouses = new List<Contact>();
    Contact spouse;
        for (Contact c : Trigger.new){
        if (c.Spouse__c != null){
        
            spouse = [select id,Spouse__c from Contact where Id=: c.Spouse__c ];
          
           if(spouse.Spouse__c != c.id)
           {
            spouse.Spouse__c = c.id;
            spouses.add(spouse);
           }
        }
    }
    if(spouses.size()>0 && staticFlag.a ){
        staticFlag.a = false;
    update spouses;

    }
}

RustanRustan

You can override the Parent layout with the VF page, if you don't use the standard Parent layout at all.

 

 

use this as a resource

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_tabs.htm