You need to sign in to do that
Don't have an account?
Sourav P
Autopopulate teh fields based on a look field value from a different object
Hi, Can anyone help me out with thiis,
This is from a custom object " Quotation", The look up field " Main Driver" is a look up to Personal account object. The below fields are as well exists in the personal account. I need whatever value would be choosen in the main driver, automatically the below values will get pop up.
I amm trying to write a trigger for this, but just got stuck,
Error showing as, Error: Compile Error: Variable does not exist: Account.Age__c at line 7 column 17
How can i define the Account variable in the Quotation object trigger ?
trigger MainDriverRelatedFields on Quotation__c (before insert,before update) {
for(Quotation__c obj : Trigger.new){
if(obj.Main_Driver__c!=null) {
obj.AgeMainD__c=Account.Age__c;
obj.GenderMainD__c=Account.Contact_Individual_Gender__c;
}
}
}
This is from a custom object " Quotation", The look up field " Main Driver" is a look up to Personal account object. The below fields are as well exists in the personal account. I need whatever value would be choosen in the main driver, automatically the below values will get pop up.
I amm trying to write a trigger for this, but just got stuck,
Error showing as, Error: Compile Error: Variable does not exist: Account.Age__c at line 7 column 17
How can i define the Account variable in the Quotation object trigger ?
trigger MainDriverRelatedFields on Quotation__c (before insert,before update) {
for(Quotation__c obj : Trigger.new){
if(obj.Main_Driver__c!=null) {
obj.AgeMainD__c=Account.Age__c;
obj.GenderMainD__c=Account.Contact_Individual_Gender__c;
}
}
}
Ya, i am missing that. i dont know where to call the Account variable. Without calling the Account varibale it doesnt work. plz suggest
Is it somthing i need to put, Is that will work ? I tried that but it was not. If yes, where to place that in teh code ? Thanks
Account Acc=New Account
Acc.Age__c
The "Main driver" field above in the screenshot is actually a look up to the account field . Thnx
Considering this case,
You will have to create VF Page for this part. Then on select of Account on lookup field, you will have to rerender the other fields to fetch the values from Account selected.
yes that would work, But say, if we dont have the " Main Driver" look up field been filled. ( Its replicating from the account name field above, only if the field " Are you driving" field is "YES", if its "NO", then the user have to search in the " Main driver" look up. If not found any suitable value, user just need to fill the below fields, leaving the Main Driver field blank. So, if those are not visible in the edit mode, they cant fill that. So, basically if the Main Driver is filled, its ok, those will not visible in the edit mode, but if its not filled, those need to be to manually filled ( Actually , thats a Driver name, and we need to calculate premium, as per the below field, so even if no name, thats OK, but if the driver name is already there in the system, then the users have the flexibility of not to fill the below fields and those will be populated). Thanks. Can you plz suggest a way