function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AkiraDioAkiraDio 

[Возможно кто-то занет русский язык] Please help!

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;
}

 

Error: Compile Error: 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. at line 4 column 9

 

Есть тема(topic): http://boards.developerforce.com/t5/forums/forumtopicprintpage/board-id/apex/message-id/68444/print-single-message/false/page/1

 

Однако я не совсем понял как ее решить(

I do not understand how to solve it(

 



 

 

  
TeddyAbleTeddyAble

AkiraDio

 

What the error message is saying is Merchandise__r does not exist. 

 

If i guess right i think you are trying to reference a lookup field called Merchandise__r

 

Now most of the time this sort of error is based on spelling mistake (I.e not using the right Field name).

 

Why dont you check your API SETUP- DEVELOP-API- GENERATE ENTERPRISE WSDL 

This will tell you what the correct Field Name in your Org

 

Regards,

gaisergaiser

Few reasons
1. (as TeddyAble pointed out) Object Line_Item__c does not have a field called Merchandise__с (check field name spelling)
2. Object Line_Item__c does have field Merchandise__с but its type is not Lookup or Master-Detail
3. Object Line_Item__c does have field Merchandise__с and it is of correct type but the field is not visible - check field level security

All of the above can be checked via Setup->App Setup ->Create ->Objects -> find your Line_Item__c in the list of all custom objects

AkiraDioAkiraDio

Thank you, remake an application, to work!.