Skip to main content
For the below API call, I can able to pass only one parameter for the Prioriy field, is that way where I can pass more that one?

 

Eg: Query case which has priorty 1 and 2.

 

@RestResource(urlMapping='/QueryFilterStatus/*')

 

global with sharing class QueryFilterStatus{

 

    

 

    @HttpPost

 

    global static List<Case> dopostCase(String Owneremail, String Bugis, String Version, String accountid,String tracker,String priority,String contactEmail,String status,String CStatus,String subject, String Keyword) {

 

    List<Case> caseList = new List<Case>();

 

    String str='Select id, Case_Owner_Name__c, OwneEmail__c, Description, Subject, Case_Type__c, Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail, ContactId, OwnerId, CaseNumber, CSM_ID__c, CUP_Phone__c, Call_Type__c, IsClosed from Case where accountid =\''+ accountid +'\'';

 

    

 

    if(String.isNotBlank(Owneremail))

 

    {

 

       str+=' AND OwneEmail__c=\''+ Owneremail+'\'';

 

    }

 

    if(String.isNotBlank(Bugis))

 

    {

 

       str+=' AND BugIs__c=\''+ Bugis+'\'';

 

    }

 

    if(String.isNotBlank(Version))

 

    {

 

       str+=' AND Version__c=\''+ Version+'\'';

 

    }

 

    

 

    if(String.isNotBlank(tracker))

 

    {

 

       str+=' AND Tracker__c =\''+ tracker+'\'';

 

    }

 

     if(String.isNotBlank(priority))

 

    {

 

       str+=' AND Priority=\''+ priority+'\'';

 

    }

 

     if(String.isNotBlank(contactEmail))

 

    {

 

       str+=' AND ContactEmail=\''+ contactEmail+'\'';

 

    }

 

     if(String.isNotBlank(status))

 

    {

 

       str+=' AND Status =\''+ status+'\'';

 

    }

 

    

 

    if(String.isNotBlank(CStatus))

 

    {

 

       str+=' AND CStatus__c=\''+ CStatus+'\'';

 

    }

 

    

 

    //if(String.isNotBlank(subject))

 

    //{

 

    //   str+=' AND Subject Like \''+ subject+'\'';

 

   // }

 

    

 

    //if(String.isNotBlank(description))

 

    //{

 

     //  str+=' AND Description Like \''+ description+'\'';

 

    //}

 

    if(String.isNotBlank(Keyword))

 

   {

 

      str+=' AND (Subject Like\'%'+ Keyword+'%\'';

 

      str+=' OR CaseNumber Like \'%'+ Keyword+'%\')';

 

   }  

 

   System.debug(str);

 

    caseList=Database.query(str);

 

    return caseList;

 

    

 

    

 

}

 

}
4 risposte
  1. 11 feb 2019, 14:30

    Hi Thanos , thanks for your reply, but that not helping me, 

    if(String.isNotBlank(priority))

     

        {

     

           str+=' AND Priority=\''+ priority+'\'';

     

    the above line of code allow me to pass only one parameter, but I have to pass more than one,

     

    Excepted paramete to pass : Priority: 1,2,4

     

    Actual: 1

     

     
0/9000