You need to sign in to do that
Don't have an account?
Jonathan Osgood 3
Error: Invalid bind expression type of Object for column of type Id
Hi All,
Can't seem to get my WHERE clause correct. Getting Invalid bind expression type of Object for column of type Id error. Here is the full class:
Can't seem to get my WHERE clause correct. Getting Invalid bind expression type of Object for column of type Id error. Here is the full class:
public class SubmitPublicationController { @AuraEnabled public static sObject getObjectById(ID anId) { system.debug('Entering controller'); // Get the sObject token from the first ID Schema.SObjectType token = anId.getSObjectType(); // Using the token, do a describe // and construct a query dynamically. Schema.DescribeSObjectResult dr = token.getDescribe(); String queryString = 'SELECT Id, Name, Publication__c, Next_Object__r.Id, Previous_Object__r.Id FROM ' + dr.getName() + ' WHERE Id = :anId Limit 1 '; system.debug('describe object result' + dr.getName()); sObject objDBResult = Database.query(queryString); List <Publication__c> pubsList = [SELECT ID, Publication_Submitted__c FROM Publication__c WHERE ID = :objDBResult.get('Publication__c') ]; pubsList[0].Publication_Submitted__c = true; system.debug('pub ID='+pubsList); upsert pubsList; System.debug('ID is: ' + anId); System.debug('objDBResult: ' + objDBResult); return objDBResult; } }
Hope this helps!
AM
All Answers
Hope this helps!
AM