• Michael M
  • SMARTIE
  • 1520 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 177
    Questions
  • 357
    Replies
This code doesnt work.



trigger CreateCase on Contact (before insert) {
 
    List<Case> listCase = new List<Case>();
     for(Contact a : Trigger.New) {  
          listCase.add(new Case(
          AccountID=a.AccountID,        
          ContactID = a.Name,
          Priority ='High',
          Origin = 'Phone',
          Status = 'Working')); 
          }
       
     if(listCase.size() > 0)
  {
        insert listCase;
    }
}
Hello, I am trying to query by Discharge__c (custom object) record with the most recent discharge_date__c. 

This is the query I am using:

    Discharge__c dis = [select id, name_dob_formula__c, date_of_birth__c, discharge_date__c from discharge__c where Name_DOB_formula__c =: namePlusDob order by discharge_date__c desc limit 1];    

However it does not seem to be working. It is querying old discharge__c records with later discharge_date__c's  Is there something I should change in the query?
 

When I try moving a lead record in the "lost" column in my kanban view of lead records, I am receiving an error message like this: You encountered some errors when trying to save <lead record>. If the Lead is Lost, a  Reason is required. I know that the issue is because of a validation rule. My question is: is there any way this can work? For example, can we make it that a modal window of the lead record page appears so that the Lead Reason field can be filled in at that point?
Here is my trigger, class, and test code. Why is my test code not passing? 

System.NullPointerException: Argument cannot be null.
Class.LocationUpdateReferral.updateCreatedLocationsonReferral: line 13, column 1

Trigger
trigger LocationTrigger on Location__c (after update) {
    for (Location__c loc : trigger.new){
        if ( (trigger.oldMap.get(loc.Id).status__c != 'Lost' && loc.Status__c == 'Lost') || (trigger.oldMap.get(loc.Id).status__c != 'Denied' && loc.Status__c == 'Denied')){
            id refId;
            string facility;
            if (loc.Referral__c != null && loc.Location__c != null){
                refId = loc.Referral__c;
                facility = loc.Location__r.name;
                Set<string> locationNameSet = new Set<string>();
                locationNameSet.add(facility);
            LocationUpdateReferral.updateCreatedLocationsonReferral(refId, locationNameSet );
        }    
        }
}
}


Class
public class LocationUpdateReferral {
@future (callout = true)
    public static void updateCreatedLocationsonReferral(id refId, set<string> facility){
        
        lead ref = [select id, All_Locations_Hidden__c from lead where id = : refId];
        
        if (ref.All_Locations_Hidden__c != null){
            
            for (string loc : facility){
                string semiFirst = ';' + loc;
                string semiLast = loc + ';';
                
                if (ref.All_Locations_Hidden__c.contains(loc)){
                    ref.All_Locations_Hidden__c =  ref.All_Locations_Hidden__c.remove(loc);
                }
                else if (ref.All_Locations_Hidden__c.contains(loc)){
                    ref.All_Locations_Hidden__c =  ref.All_Locations_Hidden__c.remove(loc);
                }
            }
            update ref;
        }
        return;
    }
}


Test
@isTest
public class LocationCLeadHandlerTest {
    
    static testMethod void refTestMethod(){
        Id facilityAccountid = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Facility Account').getRecordTypeId();
        Account a = new Account(name = 'Essex Center', recordtypeid = facilityAccountid);
        insert a;

        date d = date.today();
        Lead l = new Lead(firstname = 'John', lastname = 'Smith', patient_dob__c = d, insurancecompany__c = acc.id, All_Locations_Hidden__c = 'Essex Center;');
        insert l;
        
        Location__c loc = new Location__c (referral__c = l.id, location__c = a.Id);
        insert loc;
        
        loc = [select id, status__c, denial_lost_reason__c from location__c where id = :loc.id];
        loc.Status__c = 'Lost';
        loc.Denial_Lost_Reason__c = 'Other SNF';
        update loc;
    }
}
Hello, we would like to add the Account name to the html email status report. Meaning the Contact's parent Account. Is that possible?
Hello, i need to find records where a long text area field is not null. However i am getting an error that you cannot filter soql queries with long text areas. Is there any way to workaround this?
Hi All, this may be a basic question. Is it possible to change the text of the resting state of the einstein bot where it says by default "Chat with an Expert". I would like to change the words, as well as the colors, and to add a custom picture to that resting state of the bot as well. Is this possible, and can you please be very specific. Thank you very muchUser-added image
Hello, i want to run a simply soql query for Contacts where the createddate is after 11/05/2020. What would be the syntax for this?
Hello I want to add the following code to my embedded service code snippet. However I cannot seem to edit that code. I found this webstie https://help.salesforce.com/articleView?id=snapins_chat_customize_code.htm&type=5 but don't understand all the steps. Are there simple steps you can provide so that I can add this code to my embedded service code snippet?

embedded_svc.settings.extraPrechatFormDetails = [{ "label": "URL", "value": window.location.href, "displayToAgent": true, "transcriptFields": ["URL__c"] }];
Hello, I am trying to find a way to embed a youtube video in my Einstein bot. 
Here is the method I'm trying:
1) This "Chat Lightning Web Compoent Pack" app (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FoirpUAB&tab=r) has a feature that let's you add a flow screen display in your chat. 
2) This app (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000Ed00FUAR) let's you embed a youtube video in your screen flow. 

I created a flow with the second app, and am trying to call it with the first app, but when I preview the bot, it is just saying showing an iFrame that says: xyz(my org).my.salesforce.com refused to connect. The syntax I am using is with a "Message" action that looks like this: lwc:flow:{/flow/Centers_Video}. Anyone have an idea of why this isn't working or how I can get it to work? (Also open to any other way of embedding a youtube video if you know of one!)
Hello, we want to send an email survey to a number of our contacts. Is there any way to do this and be able to have all of the survey results land in Salesforce? It can be with apex/vf component/template etc?
We want to place our chatbot and several different websites. All of them will have the same menu options, but for one of the dialogues, which plays a video when the user clicks on it, we want that video to be different depending on which website it is on. I am trying to avoid using a completely different chatbot. Is there a way to get the URL as a variable, and then based on that, display a different video for each website it on?
Anyone know what the issue is? 

My VF page is displaying fine for me (admin), but other users are seeing this on the page display:


Object type not accessible. Please check permissions and make sure the object is not in development mode: No such column 'Referral_Name__c' on entity 'Eligibility__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.. Original queryString was: 'SELECT Created_Date_formula__c, (SELECT Address_Number_and_Street__c, Anniversary_Date__c, City__c, Client_ID__c, County_formula__c, CS_Code10__c, CS_Code11__c, CS_Code12__c, CS_Code13__c, CS_Code14__c, CS_Code15__c, CS_Code16__c, CS_Code17__c, CS_Code18__c, CS_Code19__c, CS_Code1__c, CS_Code20__c, CS_Code2__c, CS_Code3__c, CS_Code4__c, CS_Code5__c, CS_Code6__c, CS_Code7__c, CS_Code8__c, CS_Code9__c, CS_Description10__c, CS_Description11__c, CS_Description12__c, CS_Description13__c, CS_Description14__c, CS_Description15__c, CS_Description16__c, CS_Description17__c, CS_Description18__c, CS_Description19__c, CS_Description1__c, CS_Description20__c, CS_Description2__c, CS_Description3__c, CS_Description4__c, CS_Description5__c, CS_Description6__c, CS_Description7__c, CS_Description8__c, CS_Description9__c, Date_of_Birth__c, Date_of_Service__c, eMeds_error_message__c, Exception_Code1__c, Exception_Code2__c, Exception_Code3__c, Exception_Code4__c, Exception_Code5__c, Gender_Formula__c, Id, Medicare_Identifier__c, Name_formula__c, NAMI_Amount__c, NAMI_Effective_Date__c, Office__c, Other_Payer1_Name__c, Other_Payer2_Name__c, Other_Payer3_Name__c, Other_Payer_Name__c, Plan__c, Plan_Address_2__c, Plan_Address_City__c, Plan_Address_Number_and_Street__c, Plan_Address_State__c, Plan_Address_Zip_Code__c, Plan_Code__c, Plan_Date__c, Plan_Name__c, Plan_Phone_Number__c, Provider1__c, Provider2__c, Provider3__c, Provider4__c, Provider5__c, Recertification_Month__c, State__c, Third_Party1_Address_2__c, Third_Party1_Address_Number_and_Street__c, Third_Party1_benefit_id__c, Third_Party1_City__c, Third_Party1_Group_Number__c, Third_Party1_Phone__c, Third_Party1_Policy_Number__c, Third_Party1_State__c, Third_Party1_Zip_Code__c, Third_Party2_Address_2__c, Third_Party2_Address_Number_and_Street__c, Third_Party2_benefit_id__c, Third_Party2_City__c, Third_Party2_Group_Number__c, Third_Party2_Phone__c, Third_Party2_Policy_Number__c, Third_Party2_State__c, Third_Party2_Zip_Code__c, Third_Party3_Address_2__c, Third_Party3_Address_Number_and_Street__c, Third_Party3_benefit_id__c, Third_Party3_City__c, Third_Party3_Group_Number__c, Third_Party3_Phone__c, Third_Party3_Policy_Number__c, Third_Party3_State__c, Third_Party3_Zip_Code__c, Zip_Code__c FROM Eligibilities__r), Id, Patient_SSN__c FROM Lead WHERE id = '00Q63000007eJqq''


Here is the VF page:
<apex:page standardController="Lead"  lightningStylesheets="true">

    
    <apex:stylesheet value="{!$Resource.emedCss}"/>  
  
    
<!-- Header section --> 
    <div>
        <div style = "float: left"> {!lead.Created_Date_formula__c} </div>
        <div style = "float: right; font-size: 14px; position: relative; padding-right:30%;"> eMeds Eligibility Response Details - Salesforce </div>
    </div>
    <br/>
    <apex:image id="theImage" value="{!$Resource.eMedSymbol}" width="500" height="45"/>
 <h2>
     Eligibility Response Details 
    </h2> 
<apex:pageBlock mode="maindetail">
  <apex:repeat value="{!Lead.Eligibilities__r}" var="ci">  
      <!-- Error Message -->
    <apex:outputPanel rendered="{!IF(ci.eMeds_error_message__c ='' || ci.eMeds_error_message__c = null,false,true)}">
        <h2 style = "background-color: #faed27 ;">
          {!ci.emeds_error_message__c}
        </h2>
      </apex:outputPanel>     
  <!-- Missing Fields Information  
    <apex:outputPanel rendered="{!IF(  lead.medicaid_id__c = null && lead.patient_ssn__c = null,false,true)}">
        <h2 style = "background-color: #faed27 ;">
          Medicaid ID and SSN fields are both empty. Please fill in one of them to make the callout. 
        </h2>
      </apex:outputPanel>   -->        

<!-- Client Information -->
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Client_ID__c ='' ||  ci.Client_ID__c = null ,false,true)}">           
<div class= "containerOfContainer">
    <div class="container">
 <h3>
     Client Information:
 </h3>
<div class="floatLeft">
    
<table>
  <tr>
    <th>Client ID:</th>
    <td>{!ci.Client_ID__c}</td>
  </tr>
  <tr>
    <th>Gender:</th>
    <td>{!ci.Gender_Formula__c}</td>
  </tr>
  <tr>
    <th>Date of Birth:</th>
    <td>{!ci.Date_of_Birth__c}</td>
  </tr>
  <tr>
    <th>Anniversary Date:</th>
    <td>{!ci.Anniversary_Date__c}</td>
  </tr>
  <tr>
    <th>Recertification:</th>
    <td>{!ci.Recertification_Month__c}</td>
  </tr>
  <tr>
    <th>County:</th>
    <td>{!ci.County_formula__c}</td>
  </tr>
  <tr>
    <th>Date of Service:</th>
    <td>{!ci.Date_of_Service__c}</td>
  </tr>    
   <tr>
    <th></th>
    <td></td>
  </tr>  
</table>
    <br/>
</div>

<div class="floatRight">
<table>
  <tr>
    <th>Client Name:</th>
    <td>{!ci.Name_formula__c}</td>
  </tr>
  <tr>
    <th>SSN:</th>
    <td>{!lead.patient_ssn__c}</td>
  </tr>
  <tr>
    <th>Address:</th>
    <td>{!ci.Address_Number_and_Street__c}</td>
  </tr>
  <tr>
  <!--  <th>Address 2:</th>
    <td></td>
  </tr>
  <tr> --> 
    <th>City, State Zip:</th>
    <td>{!ci.City__c}, {!ci.State__c}  {!ci.Zip_Code__c}</td>
  </tr>
  <tr>
    <th>Office:</th>
    <td>{!ci.Office__c}</td>
  </tr>
  <tr>
    <th>Plan Date:</th>
    <td>{!ci.Plan_Date__c}</td>
  </tr>        
</table>
    <br/>
</div>
</div>
</div>
</apex:outputPanel>
    <br/>
<!-- Medicaid Eligibility Information-->   
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.CS_Code1__c ='' ||  ci.CS_Code1__c = null ,false,true)}">       
<div class= "containerOfContainer">
<div class="container">
   <h3>
     Medicaid Eligibility Information:
   </h3>            
   <h3 class="planName"> 
      {!ci.Plan__c}  
    </h3>
  <!-- NAMI -->
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.NAMI_Amount__c ='' ||  ci.NAMI_Amount__c = null ,false,true)}">        
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; {!ci.NAMI_Amount__c}
    <br/>
 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {!ci.NAMI_Effective_Date__c}
    </apex:outputPanel>    
    <h4>
      Covered Services  
    </h4>
 <table  class="boxedInTable">
    <col style="width:15%"/>
    <col style="width:40%"/>  
     <tr>
     <th>Code</th>
     <th> Description</th>
     </tr>       
     <tr>
     <td>{!ci.CS_Code1__c}</td>
     <td>{!ci.CS_Description1__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code2__c}</td>
     <td>{!ci.CS_Description2__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code3__c}</td>
     <td>{!ci.CS_Description3__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code4__c}</td>
     <td>{!ci.CS_Description4__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code5__c}</td>
     <td>{!ci.CS_Description5__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code6__c}</td>
     <td>{!ci.CS_Description6__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code7__c}</td>
     <td>{!ci.CS_Description7__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code8__c}</td>
     <td>{!ci.CS_Description8__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code9__c}</td>
     <td>{!ci.CS_Description9__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code10__c}</td>
     <td>{!ci.CS_Description10__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code11__c}</td>
     <td>{!ci.CS_Description11__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code12__c}</td>
     <td>{!ci.CS_Description12__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code13__c}</td>
     <td>{!ci.CS_Description13__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code14__c}</td>
     <td>{!ci.CS_Description14__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code15__c}</td>
     <td>{!ci.CS_Description15__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code16__c}</td>
     <td>{!ci.CS_Description16__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code17__c}</td>
     <td>{!ci.CS_Description17__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code18__c}</td>
     <td>{!ci.CS_Description18__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code19__c}</td>
     <td>{!ci.CS_Description19__c}</td>
     </tr>
      <tr>
     <td>{!ci.CS_Code20__c}</td>
     <td>{!ci.CS_Description20__c}</td>
     </tr>     
 </table>
    <br/>
</div>
</div>   
    </apex:outputPanel>    
    <br/>
<!-- Medicaid Managed Care -->
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Plan_Name__c ='' ||  ci.Plan_Name__c = null ,false,true)}">           
<div class= "containerOfContainer">
<div class="container">
   <h3>
     Medicaid Managed Care:
   </h3> 
<table class="boxedInTable">
  <tr>
    <th>Plan name:</th>
    <td>{!ci.Plan_Name__c}</td>
  </tr>
  <tr>
    <th>Address:</th>
      <td>{!ci.Plan_Address_Number_and_Street__c} {!ci.Plan_Address_2__c}, {!ci.Plan_Address_City__c} {!ci.Plan_Address_State__c} {!ci.Plan_Address_Zip_Code__c}</td>
  </tr>
  <tr>
    <th>Phone:</th>
    <td>{!ci.Plan_Phone_Number__c}</td>
  </tr>
  <tr>
    <th>Plan Code:</th>
    <td>{!ci.Plan_Code__c}</td>
  </tr>
</table>  
    <br/>
</div>
</div> 
    </apex:outputPanel>
    <br/>
    
<!-- Medicaid Exceptions -->
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Exception_Code1__c ='' ||  ci.Exception_Code1__c = null ,false,true)}">               
<div class= "containerOfContainer">
<div class="container">
   <h3>
       Medicaid Exceptions:
   </h3> 
 <table  class="boxedInTable">
    <col style="width:30%"/>
    <col style="width:40%"/> 
     <tr>
     <th colspan="2">Exception Code</th>
     <th style="padding-right:10px;" colspan="3">Provider</th>
     </tr>       
     <tr>
     <td>{!ci.Exception_Code1__c}</td>
     <td>{!ci.Provider1__c}</td>
     </tr>
     <tr>
     <td>{!ci.Exception_Code2__c}</td>
     <td>{!ci.Provider2__c}</td>
     </tr>
     <tr>
     <td>{!ci.Exception_Code3__c}</td>
     <td>{!ci.Provider3__c}</td>
     </tr>
     <tr>
     <td>{!ci.Exception_Code4__c}</td>
     <td>{!ci.Provider4__c}</td>
     </tr>
     <tr>
     <td>{!ci.Exception_Code5__c}</td>
     <td>{!ci.Provider5__c}</td>
     </tr>     
  </table>    
    <br/>
</div>
</div>
    </apex:outputPanel>    
    <br/> 
<!-- Medicare Information--> 
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Medicare_Identifier__c ='' ||  ci.Medicare_Identifier__c = null ,false,true)}">                   
<div class= "containerOfContainer">
<div class="container">
   <h3>
     Medicare Information:
   </h3> 
<table style="padding-left: 3px;" class="boxedInTable">
  <tr>
    <th>Other Payer Name:</th>
    <td>{!ci.Other_Payer_Name__c}</td>
  </tr>
  <tr>
    <th>Medicare Identifier:</th>
      <td>{!ci.Medicare_Identifier__c}</td>
  </tr>
</table>  
    <br/>
</div>
</div> 
    </apex:outputPanel>    
 <br/>    

<!-- Third Party Insurance -->   
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Other_Payer1_Name__c ='' ||  ci.Other_Payer1_Name__c = null ,false,true)}">        
<div class= "containerOfContainer">
<div class="container">
   <h3>
     Third Party Insurance:
   </h3>        
<table style="padding-left: 3px;" class="boxedInTable">
  <tr>
    <th>Other Payer Name:</th>
    <td>{!ci.Other_Payer1_Name__c}</td>
  </tr>
  <tr>
    <th>Carrier Code:</th>
      <td>{!ci.Third_Party1_benefit_id__c}</td>
  </tr>
 <tr>
    <th>Other Payer Address:</th>
    <td>{!ci.Third_Party1_Address_Number_and_Street__c} {!ci.Third_Party1_Address_2__c}, {!ci.Third_Party1_City__c} {!ci.Third_Party1_State__c} {!ci.Third_Party1_Zip_Code__c} </td>
  </tr>
  <tr>
    <th>Phone Number:</th>
      <td>{!ci.Third_Party1_Phone__c}</td>
  </tr>
 <tr>
    <th>Policy Number:</th>
    <td>{!ci.Third_Party1_Policy_Number__c}</td>
  </tr>   
 <tr>
    <th>Group Number:</th>
    <td>{!ci.Third_Party1_Group_Number__c}</td>
  </tr>     
</table>  
     
 <br/>  
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Other_Payer2_Name__c ='' ||  ci.Other_Payer2_Name__c = null ,false,true)}">    
 <table style="padding-left: 3px;" class="boxedInTable">
  <tr>
    <th>Other Payer Name:</th>
    <td>{!ci.Other_Payer2_Name__c}</td>
  </tr>
  <tr>
    <th>Carrier Code:</th>
      <td>{!ci.Third_Party2_benefit_id__c}</td>
  </tr>
 <tr>
    <th>Other Payer Address:</th>
    <td>{!ci.Third_Party2_Address_Number_and_Street__c} {!ci.Third_Party2_Address_2__c}, {!ci.Third_Party2_City__c} {!ci.Third_Party2_State__c} {!ci.Third_Party2_Zip_Code__c} </td>
  </tr>
  <tr>
    <th>Phone Number:</th>
      <td>{!ci.Third_Party2_Phone__c}</td>
  </tr>
 <tr>
    <th>Policy Number:</th>
    <td>{!ci.Third_Party2_Policy_Number__c}</td>
  </tr>   
 <tr>
    <th>Group Number:</th>
    <td>{!ci.Third_Party2_Group_Number__c}</td>
  </tr>     
</table>        
 <br/>  
 </apex:outputPanel>    
 
<apex:outputPanel styleClass="boldHeader" rendered="{!IF(ci.Other_Payer3_Name__c ='' ||  ci.Other_Payer3_Name__c = null ,false,true)}">       
 <table style="padding-left: 3px;" class="boxedInTable">
  <tr>
    <th>Other Payer Name:</th>
    <td>{!ci.Other_Payer3_Name__c}</td>
  </tr>
  <tr>
    <th>Carrier Code:</th>
      <td>{!ci.Third_Party3_benefit_id__c}</td>
  </tr>
 <tr>
    <th>Other Payer Address:</th>
    <td>{!ci.Third_Party3_Address_Number_and_Street__c} {!ci.Third_Party3_Address_2__c}, {!ci.Third_Party3_City__c} {!ci.Third_Party3_State__c} {!ci.Third_Party3_Zip_Code__c} </td>
  </tr>
  <tr>
    <th>Phone Number:</th>
      <td>{!ci.Third_Party3_Phone__c}</td>
  </tr>
 <tr>
    <th>Policy Number:</th>
    <td>{!ci.Third_Party3_Policy_Number__c}</td>
  </tr>   
 <tr>
    <th>Group Number:</th>
    <td>{!ci.Third_Party3_Group_Number__c}</td>
  </tr>     
</table> 
    </apex:outputPanel>    
 </div>
</div>    
</apex:outputPanel>     
     </apex:repeat>     
    </apex:pageBlock> 

          
</apex:page>
Why am I getting this error: "Static method cannot be referenced from a non static context: void EMedCalloutsExtension.makePostCallout1(List<Id>)" ?

The error appears when I try to save this test class:
@isTest
private class EmedscalloutTest2 {
     @isTest static void testCallout() {
         date d = date.today();
         lead l = new lead(firstname = 'test', lastname = 'test', patient_dob__c = d);
         insert l;
         list<string> refids = new list<string>();
         refids.add(l.id);
         
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new EmedsCalloutTest());
        
        // Call method to test.
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        EMedCalloutsExtension tw = new EMedCalloutsExtension();
        tw.makePostCallout1(refids);

    }
}


Here is my first test class/method:
@isTest
global class EmedsCalloutTest implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest req) {
        // Optionally, only send a mock response for a specific endpoint
        // and method.
        System.assertEquals('http://example.com/example/test', req.getEndpoint());
        System.assertEquals('GET', req.getMethod());
        
        // Create a fake response
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
        res.setBody('{"example":"test"}');
        res.setStatusCode(200);
        return res;
    }
}


and my actual code:
trigger  ReferralCreateContact on Lead (after insert, after update) {
if(!Test.isRunningTest()) { 
    if (trigger.isInsert){
     List<string> leadIds = new List<string>();
    for (lead ref : trigger.new){
      if(System.IsBatch() == false && System.isFuture() == false){ 
        if (ref.Epaces_Checked__c != true){
          lead newl = new lead();
          newl.Id = ref.id;
          leadIds.add(newl.id);
        EMedCalloutsExtension.makePostCallout1(leadIds); 
        }
      }}} }
public class EMedCalloutsExtension {
    static string EmedrequestId;
    static string requestStatus;
    
@future(callout = true)
public static void  makePostCallout1(list<id> refIds) {
    
  List <Lead> refs =[Select Id, firstname, lastname, gender__c, patient_dob__c, patient_ssn__c, Epaces_Checked__c, Emed_Request_Id__c, medicaid_id__c, medicare_id__c from Lead where Id in :refIds]; 
     List<lead> refToUpdate = new List<Lead>();      
           for (lead ref : refs){

 //Set up reassignment of static resource string items              
   String ssnReplace; 
           if (ref.Patient_SSN__c != null){
            ssnReplace = ref.Patient_SSN__c.replace('-','');
           }
    String genderLetter;
           if (ref.Gender__c == 'Male'){
               genderLetter = 'M';
           } else if (ref.Gender__c == 'Female'){
               genderLetter = 'F';
           }
           
           String first;
           String second;
           String third;
            String d = String.valueOf(ref.Patient_DOB__c);
           system.debug('***dob string raw: ' + d);
                first = d.substring(0,4);
                second = d.substring(5,7);
                third = d.substring(8,10);
           String dob = first + second + third;
           system.debug('***dob formatted: ' + dob);

 
//REQUEST #1          
      string reqbody;
     StaticResource r =[Select Id,Body from StaticResource where Name='EMedCalloutBody' limit 1];
      reqBody=r.body.toString(); 
     // reqBody=reqBody.replace('{{FirstName}}', ref.firstname);     
     // reqBody=reqBody.replace('{{LastName}}', ref.lastname);  
               if (ref.Medicaid_ID__c != null){
     // reqBody=reqBody.replace('{{MedicaidId}}', ref.medicaid_id__c); 
      reqBody = reqBody.replace('{{residentInfo}}', '{"first_name": "'+ ref.firstname +'", "last_name": "' + ref.lastname +'", "id_type":"MI", "subscriber_id":"' + ref.medicaid_id__c + '"}');             
               } 
               else if (ref.gender__c != null && ref.Patient_DOB__c != null && ref.Patient_SSN__c != null){
                   reqBody = reqBody.replace('{{residentInfo}}', '{"first_name": "'+ ref.firstname +'", "last_name": "' + ref.lastname +'", "gender":"' + genderLetter + '", "birthdate": "' + dob + '", "social_security_number": "' + ssnReplace + '"}');    
               }
       HttpRequest req = new HttpRequest();
           req.setHeader('Content-Type', 'application/json');
                req.setMethod('POST');
                req.setBody(reqBody);
                req.setEndpoint('callout:Emed');
                req.setTimeout(2 * 60 * 1000);
                    system.debug('ENDPOINT: ' + req.getendpoint());
                       system.debug('BODY: '+ req.getBody());
         Http http = new Http();
           HttpResponse response = http.send(req);
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            system.debug(response.getstatuscode());
           System.debug(response.getBody());
             string requestId = response.getbody().substringAfter('"request_id": ').substringBefore(',');
      //      ref.Emed_Request_Id__c = requestId;
            EmedrequestId = requestId;
            

              string reqbodyResp;   
              StaticResource r2 =[Select Id,Body from StaticResource where Name='EmedResponseBody' limit 1];
               reqbodyResp=r2.body.toString();
              reqbodyResp=reqbodyResp.replace('{{requestId}}', EmedrequestId);
               
               HttpRequest req2 = new HttpRequest();
                  req2.setHeader('Content-Type', 'application/json');
                req2.setMethod('POST');
                req2.setBody(reqbodyResp);
                req2.setEndpoint('callout:Emed_Response');
                req2.setTimeout(2 * 60 * 1000);
                        system.debug('ENDPOINT2: ' + req2.getendpoint());
                        system.debug('BODY2: '+ req2.getBody());
                  Http http2 = new Http();
                 HttpResponse response2 = http2.send(req2);
               
        if (response2.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                response2.getStatusCode() + ' ' + response2.getStatus());
        } else {
            system.debug(response2.getstatuscode());
           System.debug(response2.getBody());
            Id refId = ref.id;
            // instantiate a new instance of the Queueable class
            EmedFollowupCallout makeAnotherFollowUp = new EmedFollowupCallout(response2.getBody(), refId, requestId);
            // enqueue the job for processing
            ID jobID = System.enqueueJob(makeAnotherFollowUp);

           } 
 
        }
          return;
    } 
}
   
}


 
I need to embed youtube videos in my einstein bot. Can I use either of these prebuilt items and use them to include a youtube video in my bot?
1. https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000Ecs9zUAB
2. https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000Ed00FUAR
Hello, I have a task to send out an email with campaign results (number of clicks, number of times opened, etc) , 3 days after any campaign is sent. Is this possible and what would you recommend?
Hello, when we send emails from Salesforce, the receiver, when he opens up the email, sees the name and the email address.

For example:
John Smith<John.smith@aol.com>

Is there a way to remove the email address from the header display, so that the receiver simply sees "John Smith" and does not see "<John.smith@aol.com>"?
Hello, I have the below apex class that is to be used to schedule merging duplicates. How would I write a test class for this? thank you!


global class purgeClDupsSchedulable implements Schedulable{
global void execute(SchedulableContext SC) {
 //** Tweak your account selection ... aka where clause ..
List<AggregateResult> MyMergeList = [SELECT Count(ID) , first_name__c, last_name__c, referral_account__c
FROM Community_Lead__c 
WHERE from_lost_referral__c=TRUE
GROUP BY first_name__c, last_name__c, referral_account__c
HAVING Count(ID) > 1 
ORDER BY Count(ID) desc
LIMIT 2000];


For (AggregateResult Agm : MyMergeList){

   String firstName = string.valueOf(agm.get('first_name__c'));
    String lastName = string.valueOf(agm.get('last_name__c'));
    date dob = date.valueOf(agm.get('dob__c'));
   community_lead__c ToAccount = [Select id, first_name__c, last_name__c from community_lead__c 
                                  where first_name__c like :firstName and last_name__c like :lastName and dob__c = :dob and createddate= today limit 1];
   community_lead__c FromAccount = [Select id, first_name__c, last_name__c from community_lead__c 
                                    where Id != :ToAccount.Id and first_name__c like :firstName and last_name__c like :lastName and dob__c = :dob and createddate= today Limit 1];

   database.merge(ToAccount , FromAccount );
}
}
}

 
Hello, I have a task to create a bit of a complicated report, and I am wondering if and how this is possible. 

The background is that our Lead object's "Status" picklist field has 2 values (for the purposes of this report) : "Accepted" and "Pending Opportunity". 

We want a report that contains data based on the following criteria:
- All Leads WHERE 1) the status was at any point in their history "Accepted" , and 2) the lead was converted into an opporunity, and 3) that opportunity''s stage became closed-won. 

Is this possible to do, and if so, how? (In case this is helpful, our Leads are connected to our Opportunities in the sense that both Leads and Opportunities have a lookup to the same Account)

If a formal "report" is not supported, can this be done with SOQL queries? 
Hello, I have a task to display a video when a user clicks on one of the options in our chatbot menu. Is there somewhere that provdies step by step instructions how to accomplish this?
Hello, I am setting up my first einstein bot... We have a dialogue that presents a menu. When the user clicks on one of the menu items (also a dialogue) we want it to automatically redirect the user to a new webpage. How can I build this into the bot/dialogue?
I am parsing JSON that is coming back from  REST callout, and when running, it is throwing this error: attempt to de-reference null object. The issue seems to be with how I am parsing the JSON, but I am not sure where I am going wrong. Can someone help?

Here is the snippet of the JSON I am parsing:
"result": {
"first_name": "JOHN",
"last_name": "SMITH",
"id_type": "MI",
"subscriber_id": "1234567",
"gender": "M",
"birthdate": "19601119",
"address": {
"info": "123 Main St.",
"city": "New York",
"state": "NY",
"zip_code": "100000"
},
"county:": {
"value": "14"
},
"office": {
"value": "H78"
},
"recert_month": {
"value": "12",
"name": "December"
},
"dates": [
{
"name": "Service",
"qualifier": "472",
"date": "2020-09-29"
},
{
"name": "Plan Begin",
"qualifier": "346",
"date": "2020-09-01"
},
{
"name": "Issue",
"qualifier": "102",
"date": "2020-06-01"
}
],


Here is how I am parsing it (bold part is causing error):
  
        Map<String, Object> wholeResponse = (Map<String, Object>) JSON.deserializeUntyped(response2.getBody());
            Map<String, Object> result = (Map<String, Object>) wholeResponse.get('result');
                Map<String, Object> residentAddress = (Map<String, Object>) result.get('address');
                   Map<String, Object> county = (Map<String, Object>) result.get('county');
                  Map<String, Object> office = (Map<String, Object>) result.get('office');
                 Map<String, Object> recert_month = (Map<String, Object>) result.get('recert_month');
        
       Eligibility__c newEligRec = new Eligibility__c(); 
        newEligRec.Referral_Name__c = ref.id;
        newEligRec.First_Name__c = string.valueof(result.get('first_name'));
        newEligRec.Last_Name__c = string.valueof(result.get('last_name'));
        newEligRec.Name_Id_Type__c = string.valueof(result.get('id_type'));
        newEligRec.Client_ID__c = string.valueOf(result.get('subscriber_id'));
        newEligRec.Gender__c = string.valueOf(result.get('gender'));
        string birthdate;
              if (string.valueof(result.get('birthdate')) != null){
                  birthdate = string.valueof(result.get('birthdate')).remove('-');
                  string year = birthdate.substring(0,4);
                  string month = birthdate.substring(4,6);
                  string day = birthdate.substring(6,8);
                 birthdate = month + '/' + day + '/' + year;
                    }
        newEligRec.Date_of_Birth__c = birthdate;
        newEligRec.Address_Number_and_Street__c = string.valueOf(residentAddress.get('info')); 
        newEligRec.City__c =  string.valueOf(residentAddress.get('city'));    
        newEligRec.State__c =  string.valueOf(residentAddress.get('state'));    
        newEligRec.Zip_Code__c = string.valueOf(residentAddress.get('zip_code'));
        newEligRec.County__c = string.valueOf(county.get('value'));
        newEligRec.Office__c = string.valueOf(office.get('value'));
        newEligRec.Recertification_Month_value__c = string.valueOf(recert_month.get('value'));
        newEligRec.Recertification_Month__c = string.valueOf(recert_month.get('name'));
Hello, Would someone be able to assist in writing a test class for the following apex class:
global class purgeFiles implements Schedulable{
    
    global void execute(SchedulableContext SC) {
        
    List<ContentDocumentLink > docs;
        docs = [SELECT Id, Linkedentity.name, Linkedentity.id,ContentDocument.CreatedDate  
                FROM contentDocumentLink 
                WHERE Linkedentityid 
                IN (SELECT Id FROM lead where createddate < Last_N_Days:7 and isconverted = false) ];  
                //may want to change to include ALL leads
                //AND ContentDocument.CreatedDate < Last_N_Days:7];
                if(!docs.isEmpty())
            delete docs;
    }
}

Thank you very much
When I try to drag my VF page to the lightning record page, and try to save, it gives this error: "Component 'Visualforce' has an invalid value for property 'Visualforce Page Name'."  What is the problem?
Hello, I am trying to query by Discharge__c (custom object) record with the most recent discharge_date__c. 

This is the query I am using:

    Discharge__c dis = [select id, name_dob_formula__c, date_of_birth__c, discharge_date__c from discharge__c where Name_DOB_formula__c =: namePlusDob order by discharge_date__c desc limit 1];    

However it does not seem to be working. It is querying old discharge__c records with later discharge_date__c's  Is there something I should change in the query?
 

When I try moving a lead record in the "lost" column in my kanban view of lead records, I am receiving an error message like this: You encountered some errors when trying to save <lead record>. If the Lead is Lost, a  Reason is required. I know that the issue is because of a validation rule. My question is: is there any way this can work? For example, can we make it that a modal window of the lead record page appears so that the Lead Reason field can be filled in at that point?
Here is my trigger, class, and test code. Why is my test code not passing? 

System.NullPointerException: Argument cannot be null.
Class.LocationUpdateReferral.updateCreatedLocationsonReferral: line 13, column 1

Trigger
trigger LocationTrigger on Location__c (after update) {
    for (Location__c loc : trigger.new){
        if ( (trigger.oldMap.get(loc.Id).status__c != 'Lost' && loc.Status__c == 'Lost') || (trigger.oldMap.get(loc.Id).status__c != 'Denied' && loc.Status__c == 'Denied')){
            id refId;
            string facility;
            if (loc.Referral__c != null && loc.Location__c != null){
                refId = loc.Referral__c;
                facility = loc.Location__r.name;
                Set<string> locationNameSet = new Set<string>();
                locationNameSet.add(facility);
            LocationUpdateReferral.updateCreatedLocationsonReferral(refId, locationNameSet );
        }    
        }
}
}


Class
public class LocationUpdateReferral {
@future (callout = true)
    public static void updateCreatedLocationsonReferral(id refId, set<string> facility){
        
        lead ref = [select id, All_Locations_Hidden__c from lead where id = : refId];
        
        if (ref.All_Locations_Hidden__c != null){
            
            for (string loc : facility){
                string semiFirst = ';' + loc;
                string semiLast = loc + ';';
                
                if (ref.All_Locations_Hidden__c.contains(loc)){
                    ref.All_Locations_Hidden__c =  ref.All_Locations_Hidden__c.remove(loc);
                }
                else if (ref.All_Locations_Hidden__c.contains(loc)){
                    ref.All_Locations_Hidden__c =  ref.All_Locations_Hidden__c.remove(loc);
                }
            }
            update ref;
        }
        return;
    }
}


Test
@isTest
public class LocationCLeadHandlerTest {
    
    static testMethod void refTestMethod(){
        Id facilityAccountid = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Facility Account').getRecordTypeId();
        Account a = new Account(name = 'Essex Center', recordtypeid = facilityAccountid);
        insert a;

        date d = date.today();
        Lead l = new Lead(firstname = 'John', lastname = 'Smith', patient_dob__c = d, insurancecompany__c = acc.id, All_Locations_Hidden__c = 'Essex Center;');
        insert l;
        
        Location__c loc = new Location__c (referral__c = l.id, location__c = a.Id);
        insert loc;
        
        loc = [select id, status__c, denial_lost_reason__c from location__c where id = :loc.id];
        loc.Status__c = 'Lost';
        loc.Denial_Lost_Reason__c = 'Other SNF';
        update loc;
    }
}
Hello, we would like to add the Account name to the html email status report. Meaning the Contact's parent Account. Is that possible?
Hello, i need to find records where a long text area field is not null. However i am getting an error that you cannot filter soql queries with long text areas. Is there any way to workaround this?
Hi All, this may be a basic question. Is it possible to change the text of the resting state of the einstein bot where it says by default "Chat with an Expert". I would like to change the words, as well as the colors, and to add a custom picture to that resting state of the bot as well. Is this possible, and can you please be very specific. Thank you very muchUser-added image
Hello, i want to run a simply soql query for Contacts where the createddate is after 11/05/2020. What would be the syntax for this?
Hello I want to add the following code to my embedded service code snippet. However I cannot seem to edit that code. I found this webstie https://help.salesforce.com/articleView?id=snapins_chat_customize_code.htm&type=5 but don't understand all the steps. Are there simple steps you can provide so that I can add this code to my embedded service code snippet?

embedded_svc.settings.extraPrechatFormDetails = [{ "label": "URL", "value": window.location.href, "displayToAgent": true, "transcriptFields": ["URL__c"] }];
We want to place our chatbot and several different websites. All of them will have the same menu options, but for one of the dialogues, which plays a video when the user clicks on it, we want that video to be different depending on which website it is on. I am trying to avoid using a completely different chatbot. Is there a way to get the URL as a variable, and then based on that, display a different video for each website it on?
Hello, I have a task to display a video when a user clicks on one of the options in our chatbot menu. Is there somewhere that provdies step by step instructions how to accomplish this?
Can we open a HTML Email template as pdf using Custom link/button, so user can print/save the document.