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

Variable Does Not Exist. But it worked in another class
I got this "Variable Does Not Exist" problem. I have a class "FranceOperations_ReloadImpressions" :
global class FranceOperations_ReloadImpressions { webservice static String getTotalImpressions(String id) { France_Operations__c [] myOperation = [select id, Mecanic_operation_LU__r.id, Mecanic_operation_LU__r.Name, Vault_Adgroup__c, VaultClone_Operation_Id__c, MCLU__c, MCLU1__c, MCLU2__c, MCLU3__c, MCLU4__c, MCLU5__c, MCLU6__c, MCLU7__c, MCLU8__c, MCLU9__c, MCLU10__c, MCLU11__c, MCLU12__c, MCLU13__c, MCLU14__c, MCLU15__c, MCLU16__c, MCLU17__c, MCLU18__c, MCLU19__c, MCLU20__c, Status__c, ID_Request_Number__c, Eligibilit_VAULT__c, Operation_ID__c from France_Operations__c where Id = :id ]; System.debug(LoggingLevel.DEBUG, 'myOperation : ' + myOperation); System.debug(LoggingLevel.DEBUG, 'MCLU1__c : ' + MCLU1__c); if (myOperation.MCLU1__c != null || myOperation.MCLU1__c != '') { String bk = null; String bk_full = null; String bk_extension = '--'; String [] bkAfterSplit = null; bk_full = myOperation.MCLU1__c; if (bk_full.contains(bk_extension)) { bkAfterSplit = bk_full.split(' -- '); bk = bkAfterSplit[0]; } else { bk = bk_full; } } else { System.debug(LoggingLevel.DEBUG, 'MCLU1__c is empty'); } // more code }
Basically, I recover data from fields from my current page. But I get the error "Variable does not exist: MCLU1__c" since
System.debug(LoggingLevel.DEBUG, 'MCLU1__c : ' + MCLU1__c);But I do get myOperation with
System.debug(LoggingLevel.DEBUG, 'myOperation : ' + myOperation);
My class is global and my webservice is static so I don't understand the range problem. I also did the same in another class and I did not get this problem...
Any input would be greatly appreciated !
Anyway, thanks for your help !
All Answers
because there is no variable name,e MCLU1__c whihc you need to refer from the object as myOperation.MCLU1__c
Thanks for your quick reply. I changed my line 11 to what you gave me. But unfortunately, it did not solved my problem. the error is still Same at line 13 (twice) and at line 20.
But it seems I don't recover my fields properly here. I tried that right after line 11 : And I got the same error : What did I do wrong or what did I miss ? My class is global and my webservice is static. So myOperation should contain those fields I specified and it should not raise a problem of range. So in worst case, my variables should be null, not non-existant.
Anyway, thanks for your help !