0

I have a case, where i need to pre-populate a lookup field's (lkp 2) data based on the record selected in another lookup field (lkp 1) in a custom object where lkp 1 and lkp 2 are two seperate custom object having 1: 1 relation ship.

I am able to display the data using formula field in text field based on selected value of lkp 1 ..But , If anyone can guide me how to use URL hijacking here to pre-populate lkp 2 value before saving the record of this custom object, would be grateful. TIA.

3
  • is it a visualforce page or standard layout ?
    – sfdc
    Feb 25, 2016 at 20:30
  • @sfdc - this is a standard layout. No scope of using VF.
    – CRM Guy
    Feb 25, 2016 at 20:32
  • Its not possible on standard layout...we can do it with trigger after saving record.
    – sfdc
    Feb 25, 2016 at 20:34

1 Answer 1

0
trigger myTrigger on ObjectA__c(before insert, before update){
    for(Object A obj : Trigger.new){
        if(obj.Lookupfield__c !=null){
            obj.secondLookUp = obj.LookupField__c;
        }
    }
}
2
  • 2
    Can you provide some explanation besides just a code dump?
    – Adrian Larson
    Feb 25, 2016 at 20:43
  • this will smash the value of any user-entered value in secondLookup__c - on a before update use case will certainly be problematic
    – cropredy
    Feb 26, 2016 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.