• Sudip Mondal 2008
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello Wonderful people.!
I am new to APEX development, currently facing problem in fetching the relevant data from the table. Any help in this regard is highly appreciated.

Below are my variables and objects:
Object : myDataTable__c
Fields : 
data1__c --> Lookup to DataTable1__c object
data2__c --> Lookup to DataTable2__c object

myDataTable__c contains different entries with relevant values containing  data1__c & data2__c.

I have called a method from the helper class, the apex method looks as below:
public static Boolean unAssignCandidate(ID pass1, ID pass2) {
List<myDataTable__c> mydt = [SELECT Id,data1__c,data2__c FROM myDataTable__c WHERE data1__c = : pass1 AND data2__c = : pass2 ];

if (mydt.size() > 0 ) {
           delete mydt;
           return True;            
        }else {
            throw new AuraHandledException('Unable to unassign the candidate.');
        }   
}

The query always returns an empty list whenever a WHERE clause is applied. 

I am sure, there is some simple mistake that I am doing, and any help towards this would be a great support..

Thanks in advance for your time!!
 
Hello Wonderful people.!
I am new to APEX development, currently facing problem in fetching the relevant data from the table. Any help in this regard is highly appreciated.

Below are my variables and objects:
Object : myDataTable__c
Fields : 
data1__c --> Lookup to DataTable1__c object
data2__c --> Lookup to DataTable2__c object

myDataTable__c contains different entries with relevant values containing  data1__c & data2__c.

I have called a method from the helper class, the apex method looks as below:
public static Boolean unAssignCandidate(ID pass1, ID pass2) {
List<myDataTable__c> mydt = [SELECT Id,data1__c,data2__c FROM myDataTable__c WHERE data1__c = : pass1 AND data2__c = : pass2 ];

if (mydt.size() > 0 ) {
           delete mydt;
           return True;            
        }else {
            throw new AuraHandledException('Unable to unassign the candidate.');
        }   
}

The query always returns an empty list whenever a WHERE clause is applied. 

I am sure, there is some simple mistake that I am doing, and any help towards this would be a great support..

Thanks in advance for your time!!