1

Hi Everyone How can i implement this code. The aim of this code is i want to retrieve all the Event__c Where the Id is IN the Booker__c in Ticket__c.Im getting an error (Invalid bind expression type of Ticket__c for Id field of SObject Event_Product__c)

@AuraEnabled
Public Static list<Ticket__c> checkRelatedTickets(String textsearch)
{
    List<String> values = getConInfo(textsearch);
    return [SELECT Booker__c FROM Ticket__c WHERE Booker__c IN:values];
}
@AuraEnabled
Public Static List<Event_Product__c> getEventId1(String textsearch){
    list<Ticket__c> val = checkRelatedTickets(textsearch);
    return [SELECT Event__c FROM Event_Product__c 
            WHERE Id IN:val];
}

1 Answer 1

1

Ticket__c is an object. You are trying to match Id with this object not Booker__c field. In getEventId1 function you should make this changes.

@AuraEnabled
Public Static List<Event_Product__c> getEventId1(String textsearch){
  list<Ticket__c> val = checkRelatedTickets(textsearch);
  Set<String> booker = new Set<String>();
  for(Integer i = 0; i < val.size(); i++){
    booker.add(val[i].Booker__c);
  }
  return [SELECT Event__c FROM Event_Product__c WHERE Id IN :booker];
}
3
  • There is on values in the booker variable :( will you please try it on your code ? Aug 18, 2015 at 8:56
  • I need to know exact object relationship between Ticket__c and Event_Product__c. From your post I understand that you are trying to get Event_Product__c records using Ticket__c objects Booker__c field values. Now, what kind of information does Event__c field has? Is it Ticket Id? Is it Booker__c? What type of field is Booker__c? Lookup, text etc?
    – tugce
    Aug 18, 2015 at 9:02
  • You are awesome :) i already solve the problem :) thankyou.. The error is in my code.. Aug 18, 2015 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .