• Ganga
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi friends
I am getting a issue on Stored XSS in my class
can any one help me out   I am new to SFDC
showing at line .....

coa = [SELECT Id, LR_Status__c, Requirement__c, Status1__c,LR_Status_Date__c,MR_Status_Date__c, LR_Date__c,
                 Candidate__c, MR_Status__c,Requirement_Owner_Email__c, R_Comments__c, LR_Comments__c, MR_Comments__c,
                 Employer_s_Authorization__c, Manager_Email_ID__c, Submitted_to_Client__c, Submitted_to_Client_Date__c,
                 Interview_Scheduled__c, Interview_Scheduled_Date__c, Interview_Accepted__c, Interview_Accepted_Date__c,
                 Client_Offered__c, Client_Offer_Date__c, Comments__c, Client_Interviewed__c, Client_Interview_Date__c,
                 Candidate_started__c, CreatedDate,started_date__c, LR_Email__c,lr_id__c, CreatedById, Name, Last_Name__c,Contract_End_Date__c,MR_Status_date1__c FROM
                 Candidate_Mapping__c where id =:cid];
                
                
             
               uEmailR = [Select Email,Manager_Email__c FROM User WHERE ID =:coa.CreatedById];      
         can = [Select Name,CreatedDate From Candidate__c WHERE ID =:coa.Candidate__c]; 
          subCandidate =string.Valueof(can.Name) + ' ' + string.Valueof(coa.Last_Name__c);       
         REmail = uEmailR.Email;         
         LREmail = uEmailR.Manager_Email__c;        
         MREmail = string.Valueof(coa.Requirement_Owner_Email__c);
        
         strCandidateStarted = coa.started_date__c;
this is my code i am getting error on these lines ......COa and can



Thanks in advance
  • February 25, 2014
  • Like
  • 0
Hi friends 
Please help to write a class on the above requirement i just tryed the class its  getting Error
So please kindly rectifyor modify my code its a simple class no requirement they told me to create a class with pass by refernce and pass by value 

my Code 
public class Value
{
public String name{get;set;}

public Value(String n){

name= n;
}

Value val = new Value('Hello');
public void byReference(Value v){

System.debug('Value in: '+v.name);

v.name = 'Goodbye';
System.debug('Value out: '+v.name);
}
byReference(val);

System.debug('New value is:' +val.name);
}





Thanks in advance 
  • January 29, 2014
  • Like
  • 0
Hi all
This is urgent please help me
I am new to salesforce ....

Thanks In advance
  • January 29, 2014
  • Like
  • 0
Hi Friends
I am new to salesforce so i am struggling abit ...with the coding so please kindly help ....... 
i want to write a test for an employee object and the class name is employee this class written by me to use in  Vf pages 
 i have created a employee object using this class in vf pages..... so now i want to test the class so i am getting error ...plase help class i wrote is 

public with sharing Class Employee
{

public String Name {get; set;}
public String Qualification {get; set;}
public Integer Age {get; set;}
public Integer Salary{get; set;}
Public String Desig{get; set;}

public list<Employee__c> getEmployeeList{get;set;}

public String getName() {
        return 'Employee';
    }
public pageReference save() {    
  Employee__c E = new Employee__c (
                           Name__c = Name,
                          
                           Desig__c = Desig,
                           Age__c = Age ,
                           Salary__c = Salary,
                           Qualification__c = Qualification   );
                    insert E;
                   
                    
                    PageReference nextPage = new PageReference('/' + E.Id);
                   
        return nextPage;
                    }
                    public PageReference saveAndNew() { 
          Employee__c Emp = new Employee__c (
                           Name__c = Name,
                          
                           Desig__c = Desig,
                           Age__c = Age ,
                           Salary__c = Salary,
                           Qualification__c = Qualification   );
         insert Emp;
      return (new ApexPages.StandardController(new Employee__c())).edit();     
     
    
    } 

public pageReference Clear()
{
pageReference page = new pageReference('https://ap1.salesforce.com/a03/o');
page.setRedirect(true);
return page;
}

public List<Employee__c> EmployeeList()
  {

     getEmployeeList = [select Name__c, Salary__c from Employee__c];
     return getEmployeeList;

}

public PageReference GetList()
{
     EmployeeList();
     return null;
}
}


and the Test class  I  wrote is
 
ERROR :System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name__c]: [Name__c]



And i have only one required field in employee object 
Name__c  and data type is    Text(20)
rest of the fields are 
Desig__c 
  Age__c 
Salary__c 
Qualification__c


@istest
public class Testclass
{

public static testmethod void Employee()
{

Employee e = new Employee();

Employee__c empc = new Employee__c();

empc.Name__c = 'Test Name';
empc.Desig__c = 'Testy Designation';
empc.Age__c = 18;
empc.Salary__c = 100;
empc.Qualification__c = 'BE';

insert empc;

e.save();
e.saveAndNew();
e.Clear();
e.GetList();

}
}



Thanks in Advance 
  • January 27, 2014
  • Like
  • 0
Hi all
I am new to salesforce i just want to write atest class on the trigger  below is the code please help me .... urgent 


Thanks in Advance




trigger Updatactcontact on Opportunity (after update) {

    Set<Id> accountidset=new Set<Id>(); 
    Map<Id,Account> mapaccount=new Map<Id,Account>();
    Map<Id,List<Contact>> mapcontacts=new Map<Id,List<Contact>>();
    List<Contact> lstcontact=new List<Contact>();

   for(Opportunity oppobj:trigger.new){
      

if(trigger.newmap.get(oppobj.id).stagename!=trigger.oldmap.get(oppobj.id).stageName)

{
           if(oppobj.accountid!=null){
               accountidset.add(oppobj.accountid);
           }             
       }  
   }
   if(accountidset!=null && accountidset.size()>0){
       for(Account actobj:[select id,name,description,(select

id,name,OpportunityUpdate__c from Contacts) from Account where id in:accountidset]){
           mapaccount.put(actobj.id,actobj);
           mapcontacts.put(actobj.id,actobj.contacts);     
       }  
   }
   for(Opportunity oppobj:trigger.new){
      

if(trigger.newmap.get(oppobj.id).stagename!=trigger.oldmap.get(oppobj.id).stageName)
{
              if(oppobj.AccountiD!=null)
              {
mapaccount.get(oppobj.AccountId).Description='Opportunity :'+oppobj.Name+'stagename changed from'+trigger.oldmap.get(oppobj.id).stageName+'to '+ trigger.newmap.get(oppobj.id).stageName;
                   for(Contact cont:mapcontacts.get(oppobj.AccountId)){
                      Contact contobj=new

Contact(id=Cont.id,OpportunityUpdate__c='Opportunity :'+oppobj.Name+' stagename changed from '+trigger.oldmap.get(oppobj.id).stageName+' to '+

trigger.newmap.get(oppobj.id).stageName);
                      lstcontact.add(contobj);
                  }           
              }
       }  
   }
  
   if(lstcontact!=null && lstcontact.size()>0)

           update lstcontact;
          
   if(mapaccount!=null && mapaccount.size()>0)
           update mapaccount.values();
}

  • January 24, 2014
  • Like
  • 0
Hi 

I am new to salesforce so i just got the requirement please give a an idea how to develop in vf pages ....
 I dont have much knowledge   about  VF pages ...please help me out 




Thanks in Advance 
  • January 22, 2014
  • Like
  • 0
Hi all
This is urgent please help me
I am new to salesforce ....

Thanks In advance
  • January 29, 2014
  • Like
  • 0
Hi Friends
I am new to salesforce so i am struggling abit ...with the coding so please kindly help ....... 
i want to write a test for an employee object and the class name is employee this class written by me to use in  Vf pages 
 i have created a employee object using this class in vf pages..... so now i want to test the class so i am getting error ...plase help class i wrote is 

public with sharing Class Employee
{

public String Name {get; set;}
public String Qualification {get; set;}
public Integer Age {get; set;}
public Integer Salary{get; set;}
Public String Desig{get; set;}

public list<Employee__c> getEmployeeList{get;set;}

public String getName() {
        return 'Employee';
    }
public pageReference save() {    
  Employee__c E = new Employee__c (
                           Name__c = Name,
                          
                           Desig__c = Desig,
                           Age__c = Age ,
                           Salary__c = Salary,
                           Qualification__c = Qualification   );
                    insert E;
                   
                    
                    PageReference nextPage = new PageReference('/' + E.Id);
                   
        return nextPage;
                    }
                    public PageReference saveAndNew() { 
          Employee__c Emp = new Employee__c (
                           Name__c = Name,
                          
                           Desig__c = Desig,
                           Age__c = Age ,
                           Salary__c = Salary,
                           Qualification__c = Qualification   );
         insert Emp;
      return (new ApexPages.StandardController(new Employee__c())).edit();     
     
    
    } 

public pageReference Clear()
{
pageReference page = new pageReference('https://ap1.salesforce.com/a03/o');
page.setRedirect(true);
return page;
}

public List<Employee__c> EmployeeList()
  {

     getEmployeeList = [select Name__c, Salary__c from Employee__c];
     return getEmployeeList;

}

public PageReference GetList()
{
     EmployeeList();
     return null;
}
}


and the Test class  I  wrote is
 
ERROR :System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name__c]: [Name__c]



And i have only one required field in employee object 
Name__c  and data type is    Text(20)
rest of the fields are 
Desig__c 
  Age__c 
Salary__c 
Qualification__c


@istest
public class Testclass
{

public static testmethod void Employee()
{

Employee e = new Employee();

Employee__c empc = new Employee__c();

empc.Name__c = 'Test Name';
empc.Desig__c = 'Testy Designation';
empc.Age__c = 18;
empc.Salary__c = 100;
empc.Qualification__c = 'BE';

insert empc;

e.save();
e.saveAndNew();
e.Clear();
e.GetList();

}
}



Thanks in Advance 
  • January 27, 2014
  • Like
  • 0
Hi all
I am new to salesforce i just want to write atest class on the trigger  below is the code please help me .... urgent 


Thanks in Advance




trigger Updatactcontact on Opportunity (after update) {

    Set<Id> accountidset=new Set<Id>(); 
    Map<Id,Account> mapaccount=new Map<Id,Account>();
    Map<Id,List<Contact>> mapcontacts=new Map<Id,List<Contact>>();
    List<Contact> lstcontact=new List<Contact>();

   for(Opportunity oppobj:trigger.new){
      

if(trigger.newmap.get(oppobj.id).stagename!=trigger.oldmap.get(oppobj.id).stageName)

{
           if(oppobj.accountid!=null){
               accountidset.add(oppobj.accountid);
           }             
       }  
   }
   if(accountidset!=null && accountidset.size()>0){
       for(Account actobj:[select id,name,description,(select

id,name,OpportunityUpdate__c from Contacts) from Account where id in:accountidset]){
           mapaccount.put(actobj.id,actobj);
           mapcontacts.put(actobj.id,actobj.contacts);     
       }  
   }
   for(Opportunity oppobj:trigger.new){
      

if(trigger.newmap.get(oppobj.id).stagename!=trigger.oldmap.get(oppobj.id).stageName)
{
              if(oppobj.AccountiD!=null)
              {
mapaccount.get(oppobj.AccountId).Description='Opportunity :'+oppobj.Name+'stagename changed from'+trigger.oldmap.get(oppobj.id).stageName+'to '+ trigger.newmap.get(oppobj.id).stageName;
                   for(Contact cont:mapcontacts.get(oppobj.AccountId)){
                      Contact contobj=new

Contact(id=Cont.id,OpportunityUpdate__c='Opportunity :'+oppobj.Name+' stagename changed from '+trigger.oldmap.get(oppobj.id).stageName+' to '+

trigger.newmap.get(oppobj.id).stageName);
                      lstcontact.add(contobj);
                  }           
              }
       }  
   }
  
   if(lstcontact!=null && lstcontact.size()>0)

           update lstcontact;
          
   if(mapaccount!=null && mapaccount.size()>0)
           update mapaccount.values();
}

  • January 24, 2014
  • Like
  • 0
Hi 

I am new to salesforce so i just got the requirement please give a an idea how to develop in vf pages ....
 I dont have much knowledge   about  VF pages ...please help me out 




Thanks in Advance 
  • January 22, 2014
  • Like
  • 0
Hi friends 
Plz help me out in writing test class for the below class 




public class EF_UpdateOKTA
{
    public EF_UpdateOKTA()
    {
        UpdateEFKotaQueue();
    }
    public void UpdateEFKotaQueue()
    {
        List<string> lstEF_OKTA_QueueID = new List<string>();
        /*string strQuery =  EF_SOQL_Statements__c.getValues('EF_OKTA_Queue_Batch_Query').Type__c + ' ' + EF_SOQL_Statements__c.getValues('EF_OKTA_Queue_Batch_Query').Fields__c +
                           EF_SOQL_Statements__c.getValues('EF_OKTA_Queue_Batch_Query').Relationship_fields__c + ' from ' +  EF_SOQL_Statements__c.getValues('EF_OKTA_Queue_Batch_Query').Object__c +
                           ' where ' + EF_SOQL_Statements__c.getValues('EF_OKTA_Queue_Batch_Query').Filter__c;
        system.debug('strQuery strQuery strQuery ::' + strQuery );
        List <EF_OKTA_Queue__c> lstEFOKTA_Queue_QueryData = Database.Query(strQuery);*/
       
        List <EF_OKTA_Queue__c> lstEFOKTA_Queue_QueryData = [SELECT Id, status__c, EF_Requested_Resource__c, OKTA_JSON__c,OKTA_Response__c, number_tried__c, EF_Requested_Resource__r.EF_Resource_Metadata__r.OKTA_App_ID__c, EF_Requested_Resource__r.EF_Request_ID__r.User_Name__r.Okta_Id__c, EF_Requested_Resource__r.Request_Type__c from EF_OKTA_Queue__c where status__c='Request Sent' and number_tried__c<10 limit 10];
        system.debug('lstEFOKTA_Queue_QueryDatalstEFOKTA_Queue_QueryData::' + lstEFOKTA_Queue_QueryData);
        
        for(EF_OKTA_Queue__c objEF_OKTA_Queue_Local : lstEFOKTA_Queue_QueryData)
        {
            lstEF_OKTA_QueueID.add(objEF_OKTA_Queue_Local.Id);
        }
       
        if(lstEF_OKTA_QueueID.size()>0)
        {
            list<EF_OKTA_Queue__c> lstEfOKtatoUpdate = new list<EF_OKTA_Queue__c>();
            for(EF_OKTA_Queue__c oQueue: [select id, EF_Requested_Resource__r.EF_Request_ID__r.Okta_Id__c,
                            EF_Requested_Resource__r.EF_Request_ID__r.User_Name__r.Okta_Id__c,
                            OKTA_JSON__c, number_tried__c, EF_Requested_Resource__r.Request_Type__c,
                            EF_Requested_Resource__r.EF_Resource_Metadata__r.OKTA_App_ID__c, Status__c
                            from EF_OKTA_Queue__c
                            where id in : lstEF_OKTA_QueueID])
            {
                string userID = oQueue.EF_Requested_Resource__r.EF_Request_ID__r.Okta_Id__c!=''?
                                oQueue.EF_Requested_Resource__r.EF_Request_ID__r.Okta_Id__c:oQueue.EF_Requested_Resource__r.EF_Request_ID__r.User_Name__r.Okta_Id__c;

                string appID = oQueue.EF_Requested_Resource__r.EF_Resource_Metadata__r.OKTA_App_ID__c;
               
                string strURLEnd = OKTA_EndPoint__c.getValues('OKTA').Site_URL__c;
                strURLEnd = strURLEnd + '/apps/' + appID + '/users/' + userID;
               
                String result     = '[]';
                String authToken    = OKTA_EndPoint__c.getValues('OKTA').Auth_token__c;
                Http h = new Http();
                HttpRequest req   = new HttpRequest();
                req.setEndpoint(strURLEnd);
                req.setMethod('GET');
                req.setHeader('Accept', 'application/json');
                req.setHeader('Authorization', authToken);
               
                HttpResponse res = h.send(req);
               
                if (200 == res.getStatusCode())
                {
                    result = res.getBody();
                    map<string, Object> mapDataToUpdate = (map<string, Object>)JSON.deserializeUntyped(result);
                   
                    if(mapDataToUpdate.get('status') == 'Completed')
                    {
                        oQueue.Status__c = 'Complete';
                        lstEfOktatoUpdate.add(oQueue);
                    }
                }
            }
           
            if(lstEfOKtatoUpdate.size()>0)
            {
                try{update lstEfOKtatoUpdate;}
                catch(Exception ex){EF_Error_Log.logException('EF_OKTA_Queue', lstEfOKtatoUpdate, 'DML', 'HIGH', ex.getMessage());
                }
            }
        }
    }


}





=====================================================================
I am struggling with the Error  test fail 


@isTest
private class EF_UpdateOKTA_Test {


    //There are three A's(Arrange, Act, Assert) that you'll need to take care of in your test class

     static testMethod void testCallout() {
      
        /* Populate Test data, in your case in EF_abc_Queue__c object and other parent object where the data is being pulled up by the SOQL you
        have in actuall class satisfying the WHERE condition(where status__c='Request Sent' and number_tried__c<10)
        Also you need to populate data into the custom setting abc_EndPoint__c
        This is where you are arranging the test data
        */
        profile p =[select id from Profile WHERE Name ='Standard User' LIMIT 1];       
         User user = new User();
        //Populate data for rest of the fields
        user.Alias = 'rrn';
        user.username = 'ganga@g.com';
        user.Email = 'rg@h.com';
        user.CommunityNickname ='raj';
        user.ProfileId = p.id;
        user.LastName = 'ganga';
        user.TimeZoneSidKey = 'America/Los_Angeles';
        user.LocaleSidKey = 'en_US';
        user.EmailEncodingKey = 'UTF-8';
        user.LanguageLocaleKey = 'en_US';
        user.Okta_Id__c = 'hi';
       
        insert user;
      
        EF_Request__c efreqobj = new EF_Request__c();
    
     efreqobj.Okta_Id__c = 'abc';
     insert efreqobj;
    
    EF_Requested__c efreqstedobj = new EF_Requested__c();
   
    efreqstedobj.EF_Request_ID__c = efreqobj.id ;
   
    efreqstedobj.Request_Type__c = 'Phone';
   
   insert  efreqstedobj;
  
   EF_Resource_Metadata__c efresourceobj =  new EF_Resource_Metadata__c();
  
   efresourceobj.Name = 'abhi';
   efresourceobj.OKTA_App_ID__c ='abcd';
  
   insert efresourceobj ;
  
  
   EF_OKTA_Queue__c efoktaQ = new EF_OKTA_Queue__c ();
 
    efoktaQ.EF_Requested_Resource__c = efreqstedobj.id;
    efoktaQ.OKTA_JSON__c = 'Hi';
    efoktaQ.OKTA_Response__c = 'hi this is a test';
    efoktaQ.CurrencyIsoCode = 'USD';
    efoktaQ.status__c = 'Request Sent';
    efoktaQ.Number_Tried__c = 8;
   
    insert efoktaQ;
   
   
     OKTA_EndPoint__c customSetting = new OKTA_EndPoint__c();
        //Populate data for the data set 'abc'
        customSetting.Name = 'testingendpoint';
        insert customSetting;
       
        Test.setMock(HttpCalloutMock.class, new  EF_UpdateOKTA_MockHttpResponseGenerator());
      
        Test.startTest();
        EF_UpdateOKTA testObj = new EF_UpdateOKTA();
       
        Test.stopTest();
      
  
        EF_OKTA_Queue__c q = [Select Status__c from EF_OKTA_Queue__c where Id = :efoktaQ.id];
        System.assert(q.Status__c == 'Complete');
      
    }
}

with one mocktest callout class written in another class already
now the Error message is 

System.NullPointerException: Attempt to de-reference a null object


Class.EF_UpdateOKTA.UpdateEFKotaQueue: line 39, column 1
Class.EF_UpdateOKTA.<init>: line 5, column 1
Class.EF_UpdateOKTA_Test.testCallout: line 78, column 1

Thanks in Advance 
Hi frnds,
Need some help for me 
to write a test class for the below class 

public class EF_GetUserDetailFormOkta_Search_AC
{

       //public String apiEndpoint = OKTA_EndPoint__c.getValues('OKTA').Site_URL__c;
       //public String result      = '[]';
       //public String authToken   = OKTA_EndPoint__c.getValues('OKTA').Auth_token__c;
     
        public string apiEndpoint   = 'http://ec2-user@ec2-54-219-23-118.us-west-1.compute.amazonaws.com:8090/allergan.oktapreview.com/api/v1/';
        public string authToken     = 'SSWS 006BBGUE4NNIpFNpdqUm8EWLELIQuQu-SoasGMeWnV';
        public Integer timeoutOKTA      = 60000; 


   
   
    public string strSearchData {get; set;}
    public List<string> lstData {get; set;}
    public List<WrapUserDetail> lstWrapAllData {get; set;}
   
    public boolean isUserNameSelected{get; set;}
    public boolean isFirstNameSelected{get; set;}
    public boolean isLastNameSelected{get; set;}
    public boolean isEmailSelected{get; set;}
    public boolean isEmployeeIDSelected{get; set;}
    public boolean isCPIDSelected{get; set;}
    public boolean isManagerIDSelected{get; set;}
   
    public class WrapUserDetail
    {
        public string strUserName {get; set;}
        public string strFirstName {get; set;}
        public string strLastName {get; set;}
        public string strTitle {get; set;}
        public string strEmail {get; set;}
        public string strEmployeeID {get; set;}
        public string strCPID {get; set;}
        public string strManager {get; set;}
        public string strLocation {get; set;}
        public string strUserOktaID {get; set;}
       
       
        public WrapUserDetail(string UserOktaID,string UserName, string FirstName, string LastName, string Title, string Email, string EmployeeID, string CPID, string Manager, string Location)
        {
            strUserOktaID = UserOktaID;
            strUserName = UserName;
            strFirstName = FirstName;
            strLastName = LastName;
            strTitle = Title;
            strEmail = Email;
            strEmployeeID = EmployeeID;
            strCPID = CPID;
            strManager = Manager;
            strLocation = Location;
        }
    }
   
    public EF_GetUserDetailFormOkta_Search_AC()
    {
        lstData = new List<string>();
        strSearchData = '';
    }
    public void SearchData()
    {
        lstWrapAllData = new List<WrapUserDetail>();
        string QueryFilter  = CreateSearchString();
        string result = getUserList(QueryFilter);
        List<object> lstAllData = (List<object>)JSON.deserializeUntyped(result);
        system.debug('lstAllDatalstAllDatalstAllData:: ' + lstAllData);
        for(object obj : lstAllData)
        {
           
            Map<string, Object> mapData = (Map<string, Object>)obj;
           
            Map<string, Object> mapProfile = (Map<string, Object>)mapData.get('profile');
            //strUserOktaID
            WrapUserDetail objWrapUserDetail = new WrapUserDetail((string)mapProfile.get('id'),(string)mapProfile.get('AGNLoginID'), (string)mapProfile.get('firstName'), (string)mapProfile.get('lastName'),
                                                                    (string)mapProfile.get('title'), (string)mapProfile.get('email'), (string)mapProfile.get('employeeID'),
                                                                    (string)mapProfile.get('IDMCPID'), (string)mapProfile.get('manager'), (string)mapProfile.get('IDMCORALLocation'));
           
            lstWrapAllData.add(objWrapUserDetail);
        }
    }
   
    /**
     * @author         Krzysztof Wasniowski <k.wasniowski@polsource.com>
     * @version        1.0
     * @date           12/1/2013
     * @description    Returns list of users maching given filter defintion from OCTA API
     * @param          string filterDefinition Filter definition, f.ex: (userName pr or name.givenName eq Edward)
     * @return         string API response (json string)
     * @throws         EF_OKTA_APIException throws an exception is response is not 200 or filter definition is empty
     */
    public String getUserList(string filterDefinition)
    {
        String result       = '[]';
       
        Http h              = new Http();
        HttpRequest req     = new HttpRequest();
        String queryParams  = '?filter=' + EncodingUtil.urlEncode(filterDefinition.trim(), 'UTF-8');
       
        system.debug('queryParamsqueryParamsqueryParams::::New ' + queryParams);
       
        req.setMethod('GET');
        req.setHeader('Accept', 'application/json');
        //req.setTimeout(timeoutOKTA);
        req.setEndpoint(apiEndpoint + '/users' + queryParams);
        req.setHeader('Authorization', authToken);
       
        system.debug('reqreqreqreq:::New ' + req);
       
        HttpResponse res = h.send(req);
        system.debug('resresresres:::New ' + res);
       
        if (200 == res.getStatusCode()) {
            result = res.getBody();
        }
       
        return result;
    }
   
    public string CreateSearchString()
    {
        string strQueryStringToReturn = '';
       
        if(isUserNameSelected)
        {
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.AGNLoginID co ' + '\'' + strSearchData + '\'';
        }
        if(isFirstNameSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.firstName co ' + '\'' + strSearchData + '\'';
        }
        if(isLastNameSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.lastName co ' + '\'' + strSearchData + '\'';
        }
        if(isEmailSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.email co ' + '\'' + strSearchData + '\'';
        }
        if(isEmployeeIDSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.employeeID co ' + '\'' + strSearchData + '\'';
        }
        if(isCPIDSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.IDMCPID co ' + '\'' + strSearchData + '\'';
        }
        if(isManagerIDSelected)
        {   
            if(strQueryStringToReturn != '')
                strQueryStringToReturn += ' or ';
           
            strQueryStringToReturn += 'profile.managerID co ' + '\'' + strSearchData + '\'';
        }
       
        system.debug('strQueryStringToReturn:::: ' + strQueryStringToReturn);
        return strQueryStringToReturn;
    }
}


Thanks in Advance 
Hii Friends

I am not familiar  at writing test clas i got arequirement
so please kindly  help me in writing this test class

this  is my class 

public class EF_Approval_Utility {
  public static string currentuser;
  public EF_Requested__c efreq = new EF_Requested__c();
  public List<EF_Request_Approve_Controller.EF_ApprovalHistory> lstApprovalHistory {get;set;}
  public EF_Approval_Utility()
  {
   
  }
  public void captureApprovalHistory(List<EF_Request_Approve_Controller.EF_ApprovalHistory> approvalHistory, String Id)
  {
    try
    {
    String historyfield='';
    for(EF_Request_Approve_Controller.EF_ApprovalHistory ah:approvalHistory)
    {
       String s = '';
       s = ah.CreatedDate +''+ah.AssignedTo+''+ah.RequestorComments+ah.ApprovedRejectedBy+ah.ApproverComments;
      historyfield = historyfield+s;
    }
    efreq = [Select Approval_Comments__c from EF_Requested__c where Id=:Id];
    efreq.Approval_Comments__c=historyfield;
    update efreq;
    }catch(Exception e)
    {
      Apexpages.addMessages(e);
    }
  }
}




Thanks in advance 
  • March 13, 2014
  • Like
  • 1