No results returned when using queryRecord with the like clause

Has anyone else come across issues with using the like clause in queryRecord? - it refuses to return any results. Example code below:


var objectName = "Content_Data_c__c";
var fields = ["Id","Name", "Content_Data_ID__c", "Content_Data_Value__c", "CreatedById", "LastModifiedById"];

var whereClause = "WHERE Content_Data_ID__c LIKE '%Sce%'";  //dont return anything

var whereClause = "WHERE Content_Data_ID__c = 'Scenario_a0D4E000004iJoSUAU_Scenario C'"; //returns the row expected


var sortClause = ["Name, ASC"];
var limit = "10";
com.veeva.clm.queryRecord(objectName, fields, whereClause, sortClause, limit, displayResult);




  • Avatar
    Jeff R Official comment


    The CONTAINS is being incorrectly used with %:

    whereClause = whereClause + " and CORE_GSK_Content_Data_ID__c CONTAINS '"+IDprefix+"_"+currentKeyMessageID+"%'";

    The CONTAINS format doesn't support the "%" wildcard - it performs a match from the start of the field against the defined text. This clause should be set to:

    whereClause = whereClause + " and CORE_GSK_Content_Data_ID__c CONTAINS '"+IDprefix+"_"+currentKeyMessageID";


  • Avatar
    Pope Woodhead Associates - Veeva Support

    When I run the statement with LIKE in the force.com developer console it returns the rows expected - so must be something to do with the Veeva JS library?

Please sign in to leave a comment.