• RitikaBhrgv
  • NEWBIE
  • 55 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
What's wrong in this code? 
I'm trying to add contact to a Business account.

public void AddContact(Account account, string firstName, string lastName)
    {
      Contact NewContact = new Contact();
     
      NewContact.FirstName = firstName;
      NewContact.LastName = lastName;
      NewContact.Account = account;
          
            System.debug('Before Insert Biz Contact123 : ' + firstName + ' - ' + lastName + ' - ' + account);
      //Insert new contact
      insert NewContact;

            System.debug('After Insert Biz Contact123 : ' + NewContact.FirstName + ' - ' + NewContact.LastName + ' - ' + NewContact.Account.Id);
    }

This is what I see in the log, but the account is not bound to the contact.

|USER_DEBUG|[143]|DEBUG|Before Insert Biz Contact123 : James - San - Account:{Name=Jaas, RecordTypeId=012Z0000000D69aIAC, Id=001Z000000k7IA7IAM}
|USER_DEBUG|[150]|DEBUG|After Insert Biz Contact123 : James - San - 001Z000000k7IA7IAM

  • March 17, 2014
  • Like
  • 0

Hello,

I want to prevent users in my Partner Community from creating Chatter Posts.  I've created a trigger that checks the the list of Partner Users and will add an error if they are Partner Community user.

However, the Trigger.new on FeedItem doesn't contain the CreatedByID or InsertedByID before Insert, so the error never fires.  Here is the debug statement for a Trigger.new on FeedItem:
(FeedItem:{ParentId=005a000000AHEzLAAX, LikeCount=null, Type=TextPost, LastModifiedDate=null, LinkUrl=null, ContentSize=null, SystemModstamp=null, ContentData=null, RelatedRecordId=null, CommentCount=null, NetworkScope=null, ConnectionId=null, Body=test 2, Title=null, InsertedById=null, CreatedById=null, CreatedDate=null, IsDeleted=false, Visibility=null, Id=null, ContentDescription=null, ContentFileName=null, ContentType=null})

Is there anyway to get the ID of the user who created the post before insert?

Thanks,
Shane

I have this code on my visualforce page:

<apex:outputPanel rendered="{!item.qns.ResponseFormat__c='P'}" >
                        <apex:selectRadio value="{!item.isSelected}" layout="pageDirection" border="0" borderVisible="false">
                            <apex:selectOptions value="{!item.prList}" />
                        </apex:selectRadio>
</apex:outputPanel>

When it is rendering in Visualforce it is placing a border around each radio button:

 User-added image

Has anyone see this and been able to fix it?

am able share a record to user using apex how to unshare a record using apex

here is my code:

vf page
------------------------------------------------------
<apex:page standardController="Job__c"   extensions="Jobformation1usercon">
    <apex:form >
                <apex:selectList size="1" value="{!jobst }" multiselect="false">
                    <apex:selectOptions value="{!Job}"> </apex:selectOptions> 
                     <apex:actionSupport event="onchange" reRender="table,opt1" />
                </apex:selectList>
    
                <apex:selectList size="1" value="{!selectedVal}" multiselect="false">
                <apex:actionSupport event="onchange" reRender="table,opt1" />
                    <apex:selectOptions value="{!Value}">
                    </apex:selectOptions>
                </apex:selectList>
               
                <apex:outputText id="opt12" value="{!selectedVal}"></apex:outputText>
               
               <apex:commandLink action="{!manualShareRead}" value="Share" id="opt1">
                </apex:commandLink>
           
     </apex:form>
</apex:page>

----------------------------------------------------------------------
apex page
----------------------------------------------------------------------------------------
public class Jobformation1usercon
{
 
    
         List<user> con1= new List<user>(); 
         public job__c j {get;set;}
         Public List<string> usertselect{get;set;}
         public string jobst { get;set;}
         public string val{ get;set;}
         public user gp {get;set;}
         public boolean nojb{get;set;}
         public String selectedVal{get;set;}
         public List<job__C> joblist = new List<job__C>();
         public Jobformation1usercon(ApexPages.StandardController controller)
        {
        }
  
    public List<SelectOption> getJob()
     {  
         List<SelectOption> option = new List<SelectOption>();
             
        for(job__c j: [Select id,name From  job__c])
         {
         
             option.add(new SelectOption(j.name,j.name));
             system.debug('option value is '+option);
            
         }
         return option;     
    }
     public List<SelectOption> getValue()
     {  
         List<SelectOption> option = new List<SelectOption>();
             
        for(user gp: [Select id,name From  user  ])
         {
         
             option.add(new SelectOption(gp.name,gp.name));
             system.debug('option value is '+option);
            
         }
         return option;     
    }
                
       public PageReference manualShareRead()
           {
             
               joblist = [select id from job__C where name=:jobst];
               con1 = [select id from user where name=:selectedVal];
               system.debug('PGList value is'+con1);
               system.debug('PGList value is'+joblist);
               Job__Share jobShr  = new Job__Share(); 
               jobShr.ParentId = joblist[0].id;
               jobShr.UserOrGroupId = con1[0].id;
               jobShr.AccessLevel = 'Read';
               jobShr.RowCause = Schema.Job__Share.RowCause.Manual;
              
             Database.SaveResult sr = Database.insert(jobShr,false);
              system.debug('sr value is'+sr);
      
             if(sr.isSuccess())
            {
               system.debug('sr.isSuccess() value:'+sr.isSuccess());
                  system.debug('if sr.isSuccess() block');
               PageReference nextpage = new PageReference('/apex/CustomTeam?id='+joblist[0].id);
             
                return nextpage;
               }
           else {
                  system.debug('inner else sr.isSuccess() block');
                     Database.Error err = sr.getErrors()[0];
                     if(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION  && 
                     err.getMessage().contains('AccessLevel')){
                      system.debug(' iner if sr.isSuccess() block');
                      PageReference nextpage = new PageReference('/apex/CustomTeam?id='+joblist[0].id);
                return nextpage;
            }
             else
             {
                      system.debug('outer else sr.isSuccess() block');
               PageReference nextpage = new PageReference('/apex/CustomTeam?id='+joblist[0].id);
                    return nextpage;
               }
             }
         
         }
  
  
       
     }


-------------------------------
here job__c is object name is one text field  am shring a reord to one user here  user is one object  .

if  i want to un share want i need to do please help on this

thanks
hareesh
I have a requirement where i need to get the date from the datepicker field and convert that into standart GMT format (yyyy-MM-ddTHH:mm:ss.SSSZ).

how do I get the value of the selected date from the datepicker field?
below is my code .

VF Page :
-----------
<apex:page controller="datePicker1" id="mypage">
    <apex:form >  
        Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />  
        <apex:commandButton action="{!displayDate}" value="dispdate" />
        {!outputdate}
    </apex:form>
</apex:page>

APEX Code :
-------------------------

public class datePicker1
{

    public String outputdate { get; set; }
     public datetime datename {get; set;}
    
     public void displayDate()
     {
        
         String formattedDate = datename.format('yyyy-mm-dd');
         outputdate = formattedDate;
        
    }
}

This code is not displaying any thing please help to get the converted date.
Hi am tryong to share one job object record to one user using apex  
Job__c is object in that name is one text field   User is one object
 am passing record id to command link but its not working please help on this:

i tryed using pageblock table and datatable but user id un able to pass to controler or takeing first values from select list takeing as default values

vf page
----------------------------------------------------------------------------

<apex:page standardController="Job__c"   extensions="Jobformation1usercon">
    <apex:form >
                <apex:selectList size="1" value="{!jobst }" multiselect="false">
                    <apex:actionSupport event="onchange" reRender="table,opt" />
                    <apex:selectOptions value="{!Job}"> </apex:selectOptions>
                </apex:selectList>
    
                 <apex:outputText id="opt" value="{!jobst }"></apex:outputText>
      
                <apex:selectList size="1" value="{!selectedVal}" multiselect="false">
                <apex:actionSupport event="onchange" reRender="table,opt1" />
                    <apex:selectOptions value="{!Value}">
                    </apex:selectOptions>
                </apex:selectList>
                <apex:outputText id="opt1" value="{!selectedVal}"></apex:outputText>
                    <apex:commandLink action="{!manualShareRead}" value="Share" id="table">
                    <apex:param name="id" value="{!Job__c.id}"/>                 
                </apex:commandLink>
           
     </apex:form>
</apex:page>
-------------------------------------------------------------------------------------------
apex page
---------------------------------------------------
public class Jobformation1usercon
{
 
    
         List<user> con1= new List<user>(); 
         public job__c j {get;set;}
         Public List<string> usertselect{get;set;}
         public string jobst { get;set;}
         public user gp {get;set;}
         public boolean nojb{get;set;}
         public String selectedVal{get;set;}
         public List<job__C> joblist {get;set;}
         public Jobformation1usercon(ApexPages.StandardController controller)
       
       {
           Id id = System.currentPageReference().getParameters().get('id');
     
        }
    public List<SelectOption> getJob()
     {  
         List<SelectOption> option = new List<SelectOption>();
             
        for(job__c j: [Select id,name From  job__c])
         {
         
             option.add(new SelectOption(j.name,j.name));
             system.debug('option value is '+option);
            
         }
         return option;     
    }
     public List<SelectOption> getValue()
     {  
         List<SelectOption> option = new List<SelectOption>();
             
        for(user gp: [Select id,name From  user  ])
         {
         
             option.add(new SelectOption(gp.name,gp.name));
             system.debug('option value is '+option);
            
         }
         return option;     
    }
                
       public PageReference manualShareRead()
           {
             
               Id id = System.currentPageReference().getParameters().get('id');
               system.debug('Id Value is'+id);
               system.debug('aaaaaaaaaaaaaaaaaaaaaa'+selectedVal);
               con1 = [select id from user where name=:selectedVal];
               system.debug('PGList value is'+con1);
               Job__Share jobShr  = new Job__Share(); 
               jobShr.ParentId = id;
               jobShr.UserOrGroupId = con1[0].id;
               jobShr.AccessLevel = 'Read';
               jobShr.RowCause = Schema.Job__Share.RowCause.Manual;
              
             Database.SaveResult sr = Database.insert(jobShr,false);
              system.debug('sr value is'+sr);
      
             if(sr.isSuccess())
            {
               system.debug('sr.isSuccess() value:'+sr.isSuccess());
                  system.debug('if sr.isSuccess() block');
               PageReference nextpage = new PageReference('/apex/CustomTeam?id='+id);
             
                return nextpage;
               }
           else {
                  system.debug('inner else sr.isSuccess() block');
                     Database.Error err = sr.getErrors()[0];
                     if(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION  && 
                     err.getMessage().contains('AccessLevel')){
                      system.debug(' iner if sr.isSuccess() block');
                      PageReference nextpage = new PageReference('/apex/CustomTeam?id='+id);
                return nextpage;
            }
             else
             {
                      system.debug('outer else sr.isSuccess() block');
               PageReference nextpage = new PageReference('/apex/CustomTeam?id='+id);
                    return nextpage;
               }
             }
         
         }
  
  
       
     }
Hey there,

I have a visualforce page with different Jquery functions. One is for highlighting rows and the other is for fixing a header whilst scrolling. For some reason, when implimenting the code in bold, it prevents me from navigating between tabs and even if I remove two of the four scripts....it will still not fix the header like it does in the second example. please help

Tabbed VF page (navigation/fixed header, highlihgting not working)

<apex:page standardController="Office__c"  showHeader="true"
tabStyle="Office__c"  >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"/>
<apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css"/>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="{!URLFOR($Resource.jquery_vfFloatingHeaders)}"></script>


<script>
$j = jQuery.noConflict();
function highlightElem(elem){
$j(elem).parent().parent().parent().find('tr').removeClass('ui-state-highlight');
$j(elem).parent().parent().addClass('ui-state-highlight');
}
</script>

<style>
.activeTab {background-color: #892034; color:White;
background-image:none}
.inactiveTab { background-color: #00204E; color:white;
background-image:none}
</style>

<style>
input[name=newNote] {
    display: none;
}
input[name=attachFile] {
    display: none;
}
</style>

<style>
        .tableContainer
        {
            height:70px;
            width: 100%;
            overflow: auto;
        }      
        .floatingStyle
        {
            position:relative;
        }
    </style>
<script>
    $(document).ready(function() {
        $('.floatingHeaderTable').vfFloatingHeaders();
    });
    </script> 
  



<apex:tabPanel switchType="client" value="{!BLANKVALUE($CurrentPage.parameters.tab,'Offdetails')}"
id="OfficeTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">
<apex:tab label="Details" name="Offdetails" id="tabdetails" >
<apex:detail inlineEdit="True" relatedList="true" title="true"/>
</apex:tab>


<apex:tab label="Office Commissions" rendered="{!$ObjectType.Office_Commission__c.Accessible}" name="Office Commissions" id="tabOfficeCommissions" >
<apex:pageBlock title="Office Commissions" >
<apex:form >
<apex:outputPanel styleClass="tableContainer" layout="block">
<apex:pageBlockTable value="{!Office__c.Office_Commissions__r}" var="OffCom" styleclass="floatingHeaderTable">
<apex:column headerValue="Office Commissions" >
<apex:commandLink rerender="OffComdetails" oncomplete="highlightElem(this);"> {!OffCom.Name}
<apex:param name="OffComid" value="{!OffCom.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!OffCom.Upfront_Bonus_Average__c}"/>
<apex:column value="{!OffCom.Ongoing_Bonus_Average__c}"/>

<apex:column value="{!OffCom.Commission_Period_Start__c}"/>
<apex:column value="{!OffCom.Commission_Period_End__c}"/>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="OffComdetails">
<apex:detail subject="{!$CurrentPage.parameters.OffComid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>


Test VF page - fixed header working

<apex:page standardController="Office__c"  >

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="{!URLFOR($Resource.jquery_vfFloatingHeaders)}"></script>
   
<style>
        .tableContainer
        {
            height:70px;
            width: 100%;
            overflow: auto;
        }      
        .floatingStyle
        {
            position:relative;
        }
    </style>

    <script>
    $(document).ready(function() {
        $('.floatingHeaderTable').vfFloatingHeaders();
    });
    </script>  

<apex:pageBlock title="Office Commissions" >
<apex:form >
<apex:outputPanel styleClass="tableContainer" layout="block">
<apex:pageBlockTable value="{!Office__c.Office_Commissions__r}" var="OffCom" styleclass="floatingHeaderTable">
<apex:column headerValue="Office Commissions" >
<apex:commandLink rerender="OffComdetails" > {!OffCom.Name}
<apex:param name="OffComid" value="{!OffCom.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!OffCom.Upfront_Bonus_Average__c}"/>
<apex:column value="{!OffCom.Ongoing_Bonus_Average__c}"/>

<apex:column value="{!OffCom.Commission_Period_Start__c}"/>
<apex:column value="{!OffCom.Commission_Period_End__c}"/>
</apex:pageBlockTable>
</apex:outputPanel>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="OffComdetails">
<apex:detail subject="{!$CurrentPage.parameters.OffComid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>

</apex:page>

What's wrong in this code? 
I'm trying to add contact to a Business account.

public void AddContact(Account account, string firstName, string lastName)
    {
      Contact NewContact = new Contact();
     
      NewContact.FirstName = firstName;
      NewContact.LastName = lastName;
      NewContact.Account = account;
          
            System.debug('Before Insert Biz Contact123 : ' + firstName + ' - ' + lastName + ' - ' + account);
      //Insert new contact
      insert NewContact;

            System.debug('After Insert Biz Contact123 : ' + NewContact.FirstName + ' - ' + NewContact.LastName + ' - ' + NewContact.Account.Id);
    }

This is what I see in the log, but the account is not bound to the contact.

|USER_DEBUG|[143]|DEBUG|Before Insert Biz Contact123 : James - San - Account:{Name=Jaas, RecordTypeId=012Z0000000D69aIAC, Id=001Z000000k7IA7IAM}
|USER_DEBUG|[150]|DEBUG|After Insert Biz Contact123 : James - San - 001Z000000k7IA7IAM

  • March 17, 2014
  • Like
  • 0

Hello,

I want to prevent users in my Partner Community from creating Chatter Posts.  I've created a trigger that checks the the list of Partner Users and will add an error if they are Partner Community user.

However, the Trigger.new on FeedItem doesn't contain the CreatedByID or InsertedByID before Insert, so the error never fires.  Here is the debug statement for a Trigger.new on FeedItem:
(FeedItem:{ParentId=005a000000AHEzLAAX, LikeCount=null, Type=TextPost, LastModifiedDate=null, LinkUrl=null, ContentSize=null, SystemModstamp=null, ContentData=null, RelatedRecordId=null, CommentCount=null, NetworkScope=null, ConnectionId=null, Body=test 2, Title=null, InsertedById=null, CreatedById=null, CreatedDate=null, IsDeleted=false, Visibility=null, Id=null, ContentDescription=null, ContentFileName=null, ContentType=null})

Is there anyway to get the ID of the user who created the post before insert?

Thanks,
Shane

To manage Internal Support a new custom object has been created (Helpdesk__c). When a New Helpdesk record is created, the Helpdesk.Owner and the Helpdesk.Contact must be the same. How to create an Apex trigger to copy from Helpdesk.Owner to Helpdesk.contact since they are both lookup fields?

Thank you.
Adelchi
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 

I am trying to use Tooling-API and query all Classes using this string: 

String soqlQuery = SELECT+Coverage,ApexClassorTrigger.name,ApexClassorTriggerId+FROM+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+=+\'01pf0000000DHYYAA4\' 

This works fine and loads the particular class, BUT if I try :

String soqlQuery =
SELECT+Coverage,ApexClassorTrigger.name,ApexClassorTriggerId+FROM+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+=+\'01p%\'

I get this error on page: " Malformed JSON: Expected '{' at the beginning of object "
Can anyone tell what is wrong ? or is it that LIKE clause cannot be used while constructing a Query ?

(This is later passed to : HTTPRequestInstance.setEndpoint(URL + soqlQuery); )