You need to sign in to do that
Don't have an account?
SamirKhan
autoPopulate lookup field
I have two custom Object , Salesorder and SalesYear.SalesYear has two records - 2015 and 2016.SalesOrder Has a lookup to Salesyear.What i am trying to achieve is when i click on new salesorder , it should auto populate a value for salesyear i.r 2016
For this i have written a trigger, and it doesnot works for some reason which i am not aware of.
Can some one guide me in achieving this?
For this i have written a trigger, and it doesnot works for some reason which i am not aware of.
Can some one guide me in achieving this?
trigger SalesOrderTrigger on gii__SalesOrder__c (before insert, before update) { Sales_year__c objSales_year = new Sales_year__c(); objSales_year = [select id from Sales_year__c where name = '2016']; for(gii__SalesOrder__c objOrder : trigger.new){ objOrder.Sales_Year__c= objSales_year.id ; } }
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html
Through trigger we cannot auto populate field values.
but we can set predefined values like
Sample :
trigger test account(before insert){
for(account a : trigger.new{
if(a.type == 'prosepect'){
a.rating = 'hot';
}
}
}
So whenever new records inserted automatically rating == hot ;