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

  • Chatter
    Feed
  • 1
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 216
    Questions
  • 404
    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, the task I am trying to accomplish is to sort my List<Map<Date,DataWrapper>> masterList first in order of dates, and then extract the specific data from each data wrapper, now that the list is ordered. This may be a basic programming question, I'm not sure. Here is the code I am attempting, but it is not working. What do I need to fix? 

Here is the data wrapper:
Public Class DataWrapper{
public String toDate;
public String NPI;
public String locationType;    
}

And here is where I am trying to sort my list and extract the data:
public class SeekPartAStays {

   public static void savePartAStaysDetails2(id EligibilityRecordid, List<Map<Date,SeekExtension.DataWrapper>> masterList){
       system.debug('MASTER LIST: ' + masterList);
    Eligibility__c eligRec = [select id from eligibility__c where id = :EligibilityRecordid];
      List<date> fromDates = new list<date>();
       Map<Date, SeekExtension.DataWrapper> dw1 = masterList[0];
       Map<Date, SeekExtension.DataWrapper> dw2;
       Map<Date, SeekExtension.DataWrapper> dw3;
       Map<Date, SeekExtension.DataWrapper> dw4;
       Map<Date, SeekExtension.DataWrapper> dw5;
       Map<Date, SeekExtension.DataWrapper> dw6;
       Map<Date, SeekExtension.DataWrapper> dw7;
       Map<Date, SeekExtension.DataWrapper> dw8;
       Map<Date, SeekExtension.DataWrapper> dw9;
       Map<Date, SeekExtension.DataWrapper> dw10;
       Map<Date, SeekExtension.DataWrapper> dw11;
       Map<Date, SeekExtension.DataWrapper> dw12;

         fromDates.addall(dw1.keyset());
       
       if (masterList.size() > 1){
           dw2 = masterList[1];
         fromDates.addall(dw2.keyset());
       }
       if (masterList.size() > 2){
           dw3 = masterList[2];
         fromDates.addall(dw3.keyset());
       }
       if (masterList.size() > 3){
           dw4 = masterList[3];
         fromDates.addall(dw4.keyset());
       }
       if (masterList.size() > 4){
           dw5 = masterList[4];
         fromDates.addall(dw5.keyset());
       }
       if (masterList.size() > 5){
           dw6 = masterList[5];
         fromDates.addall(dw6.keyset());
       }
       if (masterList.size() > 6){
           dw7 = masterList[6];
         fromDates.addall(dw7.keyset());
       }
       if (masterList.size() > 7){
           dw8 = masterList[7];
         fromDates.addall(dw8.keyset());
       }
       if (masterList.size() > 8){
           dw9 = masterList[8];
         fromDates.addall(dw9.keyset());
       }
       if (masterList.size() > 9){
           dw10 = masterList[9];
         fromDates.addall(dw10.keyset());
       }
       if (masterList.size() > 10){
           dw11 = masterList[10];
         fromDates.addall(dw11.keyset());
       }
       if (masterList.size() > 11){
           dw12 = masterList[11];
         fromDates.addall(dw12.keyset());
       }
       system.debug('MAP 1: ' + dw1);
       system.debug('MAP 2: ' + dw2);
       system.debug('MAP 3: ' + dw3);
       system.debug('MAP 4: ' + dw4);
       system.debug('MAP 5: ' + dw5);
       system.debug('MAP 6: ' + dw6);
       system.debug('MAP 7: ' + dw7);
       system.debug('MAP 8: ' + dw8);
       
        fromDates.sort();
                            system.debug('FROM DATES FIRST LIST: ' + fromDates) ;
      List<date> reversedFromDatesList = new List<date>();
        for(Integer i = fromDates.size() - 1; i >= 0; i--){
            reversedFromDatesList.add(fromDates[i]);
        }
       system.debug('REVERSED DATES LIST: ' + reversedFromDatesList) ;
       date d = date.today();
       reversedFromDatesList.add(d);
       system.debug('reversed list item 1: ' + reversedFromDatesList[0]);
       system.debug('reversed list item 2: ' + reversedFromDatesList[1]);
       system.debug('reversed list item 3: ' + reversedFromDatesList[2]);
       system.debug('reversed list item 4: ' + reversedFromDatesList[3]);
       system.debug('reversed list item 5: ' + reversedFromDatesList[4]);
       system.debug('reversed list item 6: ' + reversedFromDatesList[5]);
       system.debug('reversed list item 7: ' + reversedFromDatesList[6]);
       system.debug('reversed list item 8: ' + reversedFromDatesList[7]);
       
       SeekExtension.DataWrapper wrapper1;
       system.debug('WRAPPER1: ' + wrapper1) ;
       SeekExtension.DataWrapper wrapper2;
       SeekExtension.DataWrapper wrapper3;
       SeekExtension.DataWrapper wrapper4;
       SeekExtension.DataWrapper wrapper5;
       SeekExtension.DataWrapper wrapper6;
       SeekExtension.DataWrapper wrapper7;
       SeekExtension.DataWrapper wrapper8;
       SeekExtension.DataWrapper wrapper9;
       SeekExtension.DataWrapper wrapper10;
       SeekExtension.DataWrapper wrapper11;
       SeekExtension.DataWrapper wrapper12;   
       for (date ddd : reversedFromDatesList){
 for (Map<Date,SeekExtension.DataWrapper> dddd : masterList){
     wrapper1 = dddd.get(ddd);
     wrapper2 = dddd.get(ddd);
     wrapper3 = dddd.get(ddd);
     wrapper4 = dddd.get(ddd);
     wrapper5 = dddd.get(ddd);
     wrapper6 = dddd.get(ddd);
     wrapper7 = dddd.get(ddd);
     wrapper8 = dddd.get(ddd);
     wrapper9 = dddd.get(ddd);
     wrapper10 = dddd.get(ddd);
     wrapper11 = dddd.get(ddd);
     wrapper12 = dddd.get(ddd);
     system.debug('wrapper1: ' +wrapper1 );
     system.debug('wrapper2: ' +wrapper2);
     system.debug('wrapper3: ' +wrapper3 );
     system.debug('wrapper4: ' +wrapper4 );
     system.debug('wrapper5: ' +wrapper5 );
     system.debug('wrapper6: ' +wrapper6 );
     system.debug('wrapper7: ' +wrapper7 );
     system.debug('wrapper8: ' +wrapper8 );
 }}
       string fromDate1 = string.valueof(reversedFromDatesList[0]);                                       
       string fromDate2;                                       
       string fromDate3;                                       
       string fromDate4;                                       
       string fromDate5;                                       
       string fromDate6;                                       
       string fromDate7;                                       
       string fromDate8;                                     
       string fromDate9;                                      
       string fromDate10;                                      
       string fromDate11;                                      
       string fromDate12;
       string toDate1= wrapper1.toDate;
       string toDate2;
       string toDate3;
       string toDate4;
       string toDate5;
       string toDate6;
       string toDate7;
       string toDate8;
       string toDate9;
       string toDate10;
       string toDate11;
       string toDate12;
       string npi1= wrapper1.NPI;
       string npi2;
       string npi3;
       string npi4;
       string npi5;
       string npi6;
       string npi7;
       string npi8;
       string npi9;
       string npi10;
       string npi11;
       string npi12;
       string locationType1= wrapper1.locationType;
       string locationType2;
       string locationType3;
       string locationType4;
       string locationType5;
       string locationType6;
       string locationType7;
       string locationType8;
       string locationType9;
       string locationType10;
       string locationType11;
       string locationType12;
       system.debug('AND AGAIN. REVERSED DATES LIST: ' + reversedFromDatesList) ;
       eligRec.seek_Hospital_from_date_1__c = fromDate1;
       eligRec.seek_Hospital_to_date_1__c = toDate1;
       eligRec.seek_Hospital_NPI_1__c = npi1;
       eligRec.CS_Description1__c = locationType1;
       system.debug('wrapper1: '+ wrapper1);
       system.debug('DW2: '+ dw2);
       
    for (Map<Date,SeekExtension.DataWrapper> dd : masterList){
      
        if (dd.get( reversedFromDatesList[0]) != null){
           wrapper2 = dw2.get(reversedFromDatesList[0]);
           system.debug('TRIAL wrapper2: ' + wrapper2);
           fromDate2 = string.valueof(reversedFromDatesList[1]); 
           if (wrapper2 != null){
           toDate2= wrapper2.toDate;
           npi2= wrapper2.NPI;
           locationType2= wrapper2.locationType;
           eligRec.seek_Hospital_from_date_2__c = fromDate2;
           eligRec.seek_Hospital_to_date_2__c = toDate2;
           eligRec.seek_Hospital_NPI_2__c = npi2;
           eligRec.CS_Description2__c = locationType2;
           }
       }
       if (reversedFromDatesList.size() >= 2){
           wrapper3 = dw3.get(reversedFromDatesList[3]);
            system.debug('wrapper3: ' + wrapper3);
           fromDate3 = string.valueof(reversedFromDatesList[2]); 
           toDate3= wrapper3.toDate;
           npi3= wrapper3.NPI;
           locationType3= wrapper3.locationType;
           eligRec.seek_Hospital_from_date_3__c = fromDate3;
           eligRec.seek_Hospital_to_date_3__c = toDate3;
           eligRec.seek_Hospital_NPI_3__c = npi3;
           eligRec.CS_Description3__c = locationType3;
       }
       if (reversedFromDatesList.size() > 3){
           wrapper4 = dw4.get(reversedFromDatesList[3]);
            system.debug('wrapper4: ' + wrapper4);
           fromDate4 = string.valueof(reversedFromDatesList[3]); 
           toDate4= wrapper4.toDate;
           npi4= wrapper4.NPI;
           locationType4= wrapper4.locationType;
           eligRec.seek_Hospital_from_date_4__c = fromDate4;
           eligRec.seek_Hospital_to_date_4__c = toDate4;
           eligRec.seek_Hospital_NPI_4__c = npi4;
           eligRec.CS_Description4__c = locationType4;
       }
       if (reversedFromDatesList.size() > 4){
           wrapper5 = dw5.get(reversedFromDatesList[4]);
           fromDate5 = string.valueof(reversedFromDatesList[4]); 
           toDate5= wrapper5.toDate;
           npi5= wrapper5.NPI;
           locationType5= wrapper5.locationType;
           eligRec.seek_Hospital_from_date_5__c = fromDate5;
           eligRec.seek_Hospital_to_date_5__c = toDate5;
           eligRec.seek_Hospital_NPI_5__c = npi5;
           eligRec.CS_Description5__c = locationType5;
       }
       if (reversedFromDatesList.size() > 5){
           wrapper6 = dw6.get(reversedFromDatesList[5]);
           fromDate6 = string.valueof(reversedFromDatesList[5]); 
           toDate6= wrapper6.toDate;
           npi6= wrapper6.NPI;
           locationType6= wrapper6.locationType;
           eligRec.seek_Hospital_from_date_6__c = fromDate6;
           eligRec.seek_Hospital_to_date_6__c = toDate6;
           eligRec.seek_Hospital_NPI_6__c = npi6;
           eligRec.CS_Description6__c = locationType6;
       }
       if (reversedFromDatesList.size() > 6){
           wrapper7 = dw7.get(reversedFromDatesList[6]);
           fromDate7 = string.valueof(reversedFromDatesList[7]); 
           toDate7= wrapper7.toDate;
           npi7= wrapper7.NPI;
           locationType7= wrapper7.locationType;
           eligRec.seek_SNF_from_date_1__c = fromDate7;
           eligRec.seek_SNF_to_date_1__c = toDate7;
           eligRec.seek_SNF_NPI_1__c = npi7;
           eligRec.CS_Description7__c = locationType7;
       }
       if (reversedFromDatesList.size() > 7){
           wrapper8 = dw8.get(reversedFromDatesList[7]);
           fromDate8 = string.valueof(reversedFromDatesList[7]); 
           toDate8= wrapper8.toDate;
           npi8= wrapper8.NPI;
           locationType8= wrapper8.locationType;
           eligRec.seek_SNF_from_date_2__c = fromDate8;
           eligRec.seek_SNF_to_date_2__c = toDate8;
           eligRec.seek_SNF_NPI_2__c = npi8;
           eligRec.CS_Description8__c = locationType8;
       }
       if (reversedFromDatesList.size() > 8){
           wrapper9 = dw9.get(reversedFromDatesList[8]);
           fromDate9 = string.valueof(reversedFromDatesList[8]); 
           toDate9= wrapper9.toDate;
           npi9= wrapper9.NPI;
           locationType9= wrapper9.locationType;
           eligRec.seek_SNF_from_date_3__c = fromDate9;
           eligRec.seek_SNF_to_date_3__c = toDate9;
           eligRec.seek_SNF_NPI_3__c = npi9;
           eligRec.CS_Description9__c = locationType9;
       }
       if (reversedFromDatesList.size() > 9){
           wrapper10 = dw10.get(reversedFromDatesList[9]);
           fromDate10 = string.valueof(reversedFromDatesList[9]); 
           toDate10= wrapper10.toDate;
           npi10= wrapper10.NPI;
           locationType10= wrapper10.locationType;
           eligRec.seek_SNF_from_date_4__c = fromDate10;
           eligRec.seek_SNF_to_date_4__c = toDate10;
           eligRec.seek_SNF_NPI_4__c = npi10;
           eligRec.CS_Description10__c = locationType10;
       }
       if (reversedFromDatesList.size() > 10){
           wrapper11 = dw11.get(reversedFromDatesList[10]);
           fromDate11 = string.valueof(reversedFromDatesList[10]); 
           toDate11= wrapper11.toDate;
           npi11= wrapper11.NPI;
           locationType11= wrapper11.locationType;
           eligRec.seek_SNF_from_date_5__c = fromDate11;
           eligRec.seek_SNF_to_date_5__c = toDate11;
           eligRec.seek_SNF_NPI_5__c = npi11;
           eligRec.CS_Description11__c = locationType11;
       }
       if (reversedFromDatesList.size() > 11){
           wrapper12 = dw12.get(reversedFromDatesList[11]);
           fromDate12 = string.valueof(reversedFromDatesList[11]); 
           toDate12= wrapper12.toDate;
           npi12= wrapper12.NPI;
           locationType12= wrapper12.locationType;
           eligRec.seek_SNF_from_date_6__c = fromDate12;
           eligRec.seek_SNF_to_date_6__c = toDate12;
           eligRec.seek_SNF_NPI_6__c = npi12;
           eligRec.CS_Description12__c = locationType12;
       }
    }
    update EligRec;   
       
       
       
            }}
 
Hello, I have a class called SeekExtension, in which there is a datawrapper class like this Public Class DataWrapper{
String toDate;
String NPI;
String locationType;    
}

In that class, I have instantiated some DataWrapper class instances and added to a map like this: Map<Date, DataWrapper>.



Now, I have a second class in which I am calling those maps. My questoin is, how can I fetch the details of the DataWrapper class from those Maps? E.g. I want to see the toDate string and the NPI string. How can I get those when my map is my starting point?
Hello, I have a List<Map<Date,DataWrapper>>. The DataWrapper class looks like this: 
Public Class DataWrapper{
String toDate;
String NPI;
String locationType;    
}

I need to be able to do the following:
1) sort the items in the list in order of Date (the key values of each map), then 
2) extract the String values from each datawrapper class
3) save ALL values (date, string, string, string) from ALL list-items to fields on my custom object. Can someone assist in how to accomplish all of these steps? Thank you so much i really appreciate any help with writing this code.
Hello, I am working on a VF page, on which users can upload files. After clicking save, I am getting shown a screen with this message: 

Maximum view state size limit (170KB) exceeded. Actual view state size for this page was 1,006.033KB

Any idea how I can stop this error message? The strange thing is that the file seems to be getting uploaded anyways, so I'm not sure what to do with that message.
I have a pdf form, with blank spaces for name, address, etc. Is there a way I can save it (perhaps as a static resource?) and have it autopopulate with fields from my lead object?
Hello, I have a task to create "previous" and "next" buttons on detail page layout. I know that in my apex controller I will need to be able to write a SOQL query to fetch the record where the createddate was directly before the current record's createddate, and the record where the createddate was directly after the current record's createddate. I'm not sure if this is a basic question or not, but how can such a query be done? Thank you.
Hello, my requirement is as follows for my VF page:
1) create picklist A
2) depending on which option is selected, either display a 2nd picklist or display a free text field.
3) if the 2nd picklist is displayed, the options on the 2nd picklist need to be dependent on the selection of the picklist A. 

How would this look/be done? Thank you
Hello, I am making a post request, which returns results that look like this: 
Hospital from date 01:07/25/2020;
Hospital to date 01:08/04/2020;
Hospital NPI 01:1245678;
Hospital from date 02:06/29/2020;
Hospital to date 02:07/16/2020;
Hospital NPI 02:1245678;
Hospital from date 03:06/04/2020;
Hospital to date 03:06/09/2020;
Hospital NPI 03:1245678;
SNF from date 01:07/16/2020;
SNF to date 01:07/25/2020;
SNF NPI 01:1245678;
SNF from date 02:06/09/2020;
SNF to date 02:06/28/2020;
SNF NPI 02:1245678;
SNF from date 03:06/01/2020;
SNF to date 03:06/04/2020;
SNF NPI 03:1245678;
SNF from date 04:05/29/2020;
SNF to date 04:05/31/2020;
SNF NPI 04:1245678;


The way this works is that each 3 lines are one "group". So Hospital from date01, hospital to date01, and hospital NPI01 all go together, and same with the set with 02, and the SNF as well. What I need to do is sort of of those "groups" in order of the "from date". Meaning, I need to take all of the "From Dates" from all of the above lines (Hospital and SNF all together), and sort them in order of dates. 

I know that I can add all of the from dates to a list and sort that list. But where I am getting stuck is how do I keep the "to date" and the "NPI" together with the from date after I sort it. 

Would anyone have an idea for how i can accomplish this?
Hello, I am building a force.com site through our salesforce org. Right now, the URL is the domain name / the page name. I want to make it so that the URL is a custom URL of my choosing. Is that possible? And is it free?
Hello, one of our users wants to be able to see all of the chatter messages that she sent, all in one place. Is there a way to do that?
Hello, we just wrote a trigger to prevent one of our users from deleting files that were not created by him. This is the trigger, below. I tried writing test code, but it is covering 0% of the trigger. Any idea why, or how I can get the test code to work? 

Trigger and test below.


Trigger:
trigger FileDeletionPrevention on ContentDocument (before delete) {
    if (trigger.isBefore){
    for (ContentDocument cd : trigger.old){
            Id deleter = UserInfo.getUserId();
            Id uploader = cd.CreatedById;
        if (deleter == '0051N000006BSeyQAG'){
            if (deleter != uploader){
                cd.adderror('File cannot be deleted');
            }
        }
    }
}
}


Test:
@isTest(seealldata = true)
public class FileDeletionPreventionTest {

   @isTest
    public static void fileDeleter(){

        
        user u = [select id, name from user where name = 'Integration User'];
        
        Test.startTest();
        
      ContentVersion cv=new Contentversion();
        cv.title='ABC';
        cv.PathOnClient ='test';
        Blob b=Blob.valueOf('Unit Test Attachment Body');
        cv.versiondata=EncodingUtil.base64Decode('Unit Test Attachment Body');
        insert cv;
        
        System.runas(u){
            id cvDocId = cv.ContentDocumentId;
          list<contentDocument> cd = [select id from contentdocument where id =:cvDocId];
            delete cd;
        }
        Test.stopTest();
        
    }
}
Hello, I am using a lightning component to create new records. In sandbox it works fine, but in Production, when I click save, it is giving an error response. When I print the error message, it just says "undefined". Any idea what the issue could be?
Hello, I have a VF page that has a commandbutton that triggers an action to send an email. I am testing this in sandbox, and it works whenever I click the button, but if I login as another user, it does not work. There is no error message displayed, it just simply does not work. Why would that be? 
We need to import a number of Leads and Opportunities, but we want to link them to make it as if the Lead was "Converted" into that opportunity. Is there any way to do so, without needing to import them as leads and then manually converting every lead?
Hello, I need to create a custom button that opens a visualforce page. However, I don't want the user to be redirected to a new page. Rather, I want the visualforce page to appear in a small modal window, popped up over the record page that the user is already on. Is that possible?
Hello, I would like to set up an apex trigger after a ListEmail is sent. However, i am seeing that ListEmail object is not a choice in the list of trigger objects. There is only "ListEmailChangeEvent". I am not familiar with that trigger. What would be an example of how I could use the ListEmailChangeEvent object trigger to fire after a ListEmail is sent?
I am displaying a createddate in my VF page. However the time is showing in GMT time. How can I change that to eastern time zone? 

      <apex:column >
       <apex:facet name="header">Date Sent</apex:facet>
             <apex:outputText value="{0, date, MMMM d','  yyyy  'at' HH:mm:ss a}">
    <apex:param value="{!noteslist.createddate}" /> 
     </apex:outputText>
     </apex:column>
Hello, I am getting this error when trying to run my test class: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There exists no recipient to which you can send this List Email to.: []   Class.CampaignEmailHistoryTest.testNotesExtension: line 10, column 1


How can I fix this? 

Here is the test class:
@isTest
public class CampaignEmailHistoryTest {
    @isTest
    static void testNotesExtension(){

Campaign testCampaign= new Campaign(Name= 'Test');
insert testCampaign;
        
ListEmail le = new ListEmail(campaignId=testCampaign.id, subject= 'hey there',Status= 'Scheduled'); 
    insert le;
   
  ApexPages.StandardController con = new ApexPages.StandardController(testCampaign);
  CampaignEmailHistoryExtension  dce = new CampaignEmailHistoryExtension(con);
         
    }
    
}


And the real class:
public class CampaignEmailHistoryExtension {
public final Campaign thisCampaign;
 
    Public List<ListEmail> listEmails {get; set;}
 
    Public CampaignEmailHistoryExtension(ApexPages.StandardController stdController){
        this.thisCampaign = (Campaign)stdController.getRecord();

        try{
  
            Campaign camp=[Select Id, Name from Campaign where Id = :this.thisCampaign.id];
        
        listEmails = [SELECT ID, campaignId, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, subject, LastViewedDate
                      FROM ListEmail 
                      WHERE  campaignId IN (Select id from Campaign where Id = :this.thisCampaign.id)];
        }
        catch(exception e){
            Apexpages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.FATAL, 'No old records'));
        }       
}
}
Are there any common ID's on ListEmail and EmailStatus classes? 

My task is to get the emailstatuses of list emails sent through a campaign. I know that ListEmail class can get the CampaignID. But now I need to get the Email Statuses of those emails. Is that possible? I would be able to do it by the ownerid of the listemail or by the campaignid.  Are there any common fields between listemail and emailstatus?
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 have a List<Map<Date,DataWrapper>>. The DataWrapper class looks like this: 
Public Class DataWrapper{
String toDate;
String NPI;
String locationType;    
}

I need to be able to do the following:
1) sort the items in the list in order of Date (the key values of each map), then 
2) extract the String values from each datawrapper class
3) save ALL values (date, string, string, string) from ALL list-items to fields on my custom object. Can someone assist in how to accomplish all of these steps? Thank you so much i really appreciate any help with writing this code.
Hello, I am working on a VF page, on which users can upload files. After clicking save, I am getting shown a screen with this message: 

Maximum view state size limit (170KB) exceeded. Actual view state size for this page was 1,006.033KB

Any idea how I can stop this error message? The strange thing is that the file seems to be getting uploaded anyways, so I'm not sure what to do with that message.
I have a pdf form, with blank spaces for name, address, etc. Is there a way I can save it (perhaps as a static resource?) and have it autopopulate with fields from my lead object?
Hello, I have a task to create "previous" and "next" buttons on detail page layout. I know that in my apex controller I will need to be able to write a SOQL query to fetch the record where the createddate was directly before the current record's createddate, and the record where the createddate was directly after the current record's createddate. I'm not sure if this is a basic question or not, but how can such a query be done? Thank you.
Hello, I am making a post request, which returns results that look like this: 
Hospital from date 01:07/25/2020;
Hospital to date 01:08/04/2020;
Hospital NPI 01:1245678;
Hospital from date 02:06/29/2020;
Hospital to date 02:07/16/2020;
Hospital NPI 02:1245678;
Hospital from date 03:06/04/2020;
Hospital to date 03:06/09/2020;
Hospital NPI 03:1245678;
SNF from date 01:07/16/2020;
SNF to date 01:07/25/2020;
SNF NPI 01:1245678;
SNF from date 02:06/09/2020;
SNF to date 02:06/28/2020;
SNF NPI 02:1245678;
SNF from date 03:06/01/2020;
SNF to date 03:06/04/2020;
SNF NPI 03:1245678;
SNF from date 04:05/29/2020;
SNF to date 04:05/31/2020;
SNF NPI 04:1245678;


The way this works is that each 3 lines are one "group". So Hospital from date01, hospital to date01, and hospital NPI01 all go together, and same with the set with 02, and the SNF as well. What I need to do is sort of of those "groups" in order of the "from date". Meaning, I need to take all of the "From Dates" from all of the above lines (Hospital and SNF all together), and sort them in order of dates. 

I know that I can add all of the from dates to a list and sort that list. But where I am getting stuck is how do I keep the "to date" and the "NPI" together with the from date after I sort it. 

Would anyone have an idea for how i can accomplish this?
Hello, I am building a force.com site through our salesforce org. Right now, the URL is the domain name / the page name. I want to make it so that the URL is a custom URL of my choosing. Is that possible? And is it free?
Hello, one of our users wants to be able to see all of the chatter messages that she sent, all in one place. Is there a way to do that?
Hello, I am using a lightning component to create new records. In sandbox it works fine, but in Production, when I click save, it is giving an error response. When I print the error message, it just says "undefined". Any idea what the issue could be?
Hello, I have a VF page that has a commandbutton that triggers an action to send an email. I am testing this in sandbox, and it works whenever I click the button, but if I login as another user, it does not work. There is no error message displayed, it just simply does not work. Why would that be? 
We need to import a number of Leads and Opportunities, but we want to link them to make it as if the Lead was "Converted" into that opportunity. Is there any way to do so, without needing to import them as leads and then manually converting every lead?
Hello, I would like to set up an apex trigger after a ListEmail is sent. However, i am seeing that ListEmail object is not a choice in the list of trigger objects. There is only "ListEmailChangeEvent". I am not familiar with that trigger. What would be an example of how I could use the ListEmailChangeEvent object trigger to fire after a ListEmail is sent?
Hello, I am getting this error when trying to run my test class: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There exists no recipient to which you can send this List Email to.: []   Class.CampaignEmailHistoryTest.testNotesExtension: line 10, column 1


How can I fix this? 

Here is the test class:
@isTest
public class CampaignEmailHistoryTest {
    @isTest
    static void testNotesExtension(){

Campaign testCampaign= new Campaign(Name= 'Test');
insert testCampaign;
        
ListEmail le = new ListEmail(campaignId=testCampaign.id, subject= 'hey there',Status= 'Scheduled'); 
    insert le;
   
  ApexPages.StandardController con = new ApexPages.StandardController(testCampaign);
  CampaignEmailHistoryExtension  dce = new CampaignEmailHistoryExtension(con);
         
    }
    
}


And the real class:
public class CampaignEmailHistoryExtension {
public final Campaign thisCampaign;
 
    Public List<ListEmail> listEmails {get; set;}
 
    Public CampaignEmailHistoryExtension(ApexPages.StandardController stdController){
        this.thisCampaign = (Campaign)stdController.getRecord();

        try{
  
            Campaign camp=[Select Id, Name from Campaign where Id = :this.thisCampaign.id];
        
        listEmails = [SELECT ID, campaignId, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, subject, LastViewedDate
                      FROM ListEmail 
                      WHERE  campaignId IN (Select id from Campaign where Id = :this.thisCampaign.id)];
        }
        catch(exception e){
            Apexpages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.FATAL, 'No old records'));
        }       
}
}
Are there any common ID's on ListEmail and EmailStatus classes? 

My task is to get the emailstatuses of list emails sent through a campaign. I know that ListEmail class can get the CampaignID. But now I need to get the Email Statuses of those emails. Is that possible? I would be able to do it by the ownerid of the listemail or by the campaignid.  Are there any common fields between listemail and emailstatus?
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?
Hello, I am need to send one of our reports via csv. I am trying through apex with this code:

global class ReportEmailCharles implements system.Schedulable {
 global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O63000000uP8GEAU?csv=1');
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('report.csv');
      attachment.setBody(Blob.valueof(report.getContent().toString()));
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('Overall Pull- 2 All');
        message.setPlainTextBody('Overall Pull- 2 All');
        message.setToAddresses( new String[] { 'mm@abc.org' } );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
        
    }
}

The 18 character id of the report I'm testing is 00O63000000uP8GEAU

However the "csv" excel doc of the email I receive looks like this:

User-added image
Anything I can change in my code to make this work?