You need to sign in to do that
Don't have an account?

Unexpected token list in my trigger code
Hi i am getting error while executing the trigger so can any one help me out
ERROR MSG :· Compile Error: unexpected token: 'list' at line 8 column 47
Here is my trigger code
trigger GettingPrice on Bookings__c (before insert , before update)
{
set<string> BookingModelSet = new set<string>();
for(integer i=0;i<trigger.size;i++)
{
BookingModelSet.add(trigger.new[i].Model__c);
}
list<Vehicle_Rental_Price__c> PriceOfVehicles = list<Vehicle_Rental_Price__c>(); error in this line
Vehicle_Rental_Price__c is not an custom object its an Custom setting which has a static values
PriceOfVehicles = [select name , Rental_Price__c from Vehicle_Rental_Price__c where name in BookingModelSet];
Map<string , string> MappingPriceToModel = new Map<string , string>();
for(integer i=0;i<PriceOfVehicles.size();i++)
{
MappingPriceToModel.put(Vehicle_Rental_Price__c[i].name , Vehicle_Rental_Price__c[i].Rental_Price__c);
}
for(integer i=0 ; i<trigger.size ; i++)
{
if(MappingPriceToModel.containskey(trigger.new[i].Model__c))
trigger.new[i].price_per_day__C = MappingPriceToModel.get(trigger.new[i].model__c);
}
}
thanks...
again i am getting an error so can u help me out
Compile Error: Incompatible value type Decimal for MAP<String,String> at line 13 column 9
in this the Rental_Price__c is the field of data type currency with length 5 and ddecimal 0
i.e.
MappingPriceToModel.put(Vehicle_Rental_Price__c[i].name , String.valueOf(Vehicle_Rental_Price__c[i].Rental_Price__c));