Didn't understand relationship 'Merchandise__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
It looks like your custom object is Merchandise__c, so the related object in this case would be Merchandise__r (not plural). You are using Merchadises__r (Plural). Try taking away the 's' and use Merchandise__r.
Ninja its not working..i have checked aout all thing but ist same problem trigger HandleProductPriceChange on Merchandise__c (after update) { List<Line_Item__c> openLineItems = [SELECT j.Unit_Price__c, j.Merchandise__r.Price__c FROM Line_Item__c j WHERE j.Invoice_Statements__r.Status__c = 'Negotiating' AND j.Merchandise__r.id IN :Trigger.new FOR UPDATE]; for (Line_Item__c li: openLineItems) { if ( li.Merchandise__r.Price__c < li.Unit_Price__c ){ li.Unit_Price__c = li.Merchandise__r.Price__c; } } update openLineItems; }
Thanks ninja...problem in my custome field..when create a relationship between LIne item and merchandise (master detail relation).where i right mearchise replce to Items...
All Answers
List<Line_Item__c> openLineItems =
[SELECT j.Unit_Price__c, j.Merchandises__r.Price__c
FROM Line_Item__c j
WHERE j.Invoice_Statements__r.Status__c = 'Negotiating'
AND j.Merchandises__r.id IN :Trigger.new
FOR UPDATE];
for (Line_Item__c li: openLineItems) {
if ( li.Merchandises__r.Price__c < li.Unit_Price__c ){
li.Unit_Price__c = li.Merchandises__r.Price__c;
}
}
update openLineItems;
}
}
trigger HandleProductPriceChange on Merchandise__c (after update) {
List<Line_Item__c> openLineItems =
[SELECT j.Unit_Price__c, j.Merchandise__r.Price__c
FROM Line_Item__c j
WHERE j.Invoice_Statements__r.Status__c = 'Negotiating'
AND j.Merchandise__r.id IN :Trigger.new
FOR UPDATE];
for (Line_Item__c li: openLineItems) {
if ( li.Merchandise__r.Price__c < li.Unit_Price__c ){
li.Unit_Price__c = li.Merchandise__r.Price__c;
}
}
update openLineItems;
}
}
Thanks u very much