You need to sign in to do that
Don't have an account?
pranoti kokas 27
after update trigger error on merchandise object of warehouse application
HI everyone!
I was writing a after update trigger on merchandise object in Warehouse Application from a workbook.
Error: Compile Error: Didn't understand relationship 'Invoice_Statement__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. at line 3 column 1
Bellow is the trigger code:
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_Statement__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;
}
The code is iterating through the List of line items and Modifying the price.
Can you please guide me to rectify the error?
Thanks in advance!
I was writing a after update trigger on merchandise object in Warehouse Application from a workbook.
Error: Compile Error: Didn't understand relationship 'Invoice_Statement__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. at line 3 column 1
Bellow is the trigger code:
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_Statement__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;
}
The code is iterating through the List of line items and Modifying the price.
Can you please guide me to rectify the error?
Thanks in advance!
do you have a custom field on the Line Item object that refers to the Invoice Statement object? Is that field have an API name of Invoice_Statement__c?