1

I have just written the beginning of a new method, which looks like this:

public class SeekPartAStays {

    Public Class DataWrapper{
        String toDate;
        String NPI;
        String locationType;    
    }
    public void savePartAStaysDetails(id EligibilityRecordid,Map<Date, DataWrapper> dw1, Map<Date, DataWrapper> dw2 ,Map<Date, DataWrapper> dw3, 
                                           Map<Date, DataWrapper> dw4, Map<Date, DataWrapper> dw5, Map<Date, DataWrapper> dw6, Map<Date, DataWrapper> dw7,
                                           Map<Date, DataWrapper> dw8, Map<Date, DataWrapper> dw9, Map<Date, DataWrapper> dw10, Map<Date, DataWrapper> dw11, Map<Date, DataWrapper> dw12){
    }
}

I am trying to call this from another class, but it is showing this error:

Method does not exist or incorrect signature: void savePartAStaysDetails(Id, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>, Map<Date,SeekExtension.DataWrapper>) from the type SeekPartAStays"

Here is the other class where i am calling it (all the "PartAStaysMap's that I am calling are of type Map<Date, DataWrapper>, and I have instantiated the identical DataWrapper class in both classes:

SeekPartAStays.savePartAStaysDetails(EligibilityRecordToCreate[0].id,  
    partAStaysMap1, partAStaysMap2, 
    partAStaysMap3, partAStaysMap4, 
    partAStaysMap5, partAStaysMap6, 
    partAStaysMap7, partAStaysMap8, 
    partAStaysMap9, partAStaysMap10, 
    partAStaysMap11, partAStaysMap12
);

What is the issue here? How can i get the error message to stop showing?

2
  • When you actually try to call this method, how are you declaring your partAStaysMaps? If you're not declaring them as Map<Date, SeekPartAStays.DateWrapper>, then that's the issue. It's also unclear why you need 12 separate maps (long argument lists are a red flag), but that's a design issue rather than a syntax/semantic issue.
    – Derek F
    Apr 20 at 14:33
  • Oh man that was my problem-- SeekExtension is the name of my first class-- i needed to call the name of that class in my second class- careless mistake. Regarding your second point, when I try adding all those maps into a List<Map<Date,DataWrapper>> masterPartastaysList = new List<Map<Date,DataWrapper>>(); and then in my second class/method calling it like this: public static void partadetails ( List<Map<Date,SeekExtension.DataWrapper>> ){ } , it doesn't let me save, saying: Unexpected toekn ')' and Invalid character in identified: ')'
    – Rick
    Apr 20 at 14:38
2

savePartAStaysDetails isn't looking for any old DataWrapper, it's looking specifically for the DataWrapper class defined as an inner class of your SeekPartAStays class.

When you define an inner class, you're committing yourself to using OuterClass.InnerClass everywhere outside of the outer class.

SeekExtension.DataWrapper is a different class/type than SeekPartAStays.DataWrapper, and is not a suitable replacement (unless SeekExtension.DataWrapper extends SeekPartAStays.DataWrapper, or if both classes implement a common interface).

4
  • Thanks Derek .......
    – Rick
    Apr 20 at 15:00
  • how would I fetch items in my new class. For example, if I want to get the "toDate" string from the first map (dw1), how would I actually pull that out from it? Sorry if that's very basic.
    – Rick
    Apr 20 at 15:31
  • @Rick The format of this site encourages one question per question, so this may be better off as a separate question. If you're new to Salesforce (or a part/feature thereof) then trailhead.salesforce.com is a better place to start (trailhead has step-by-step instruction). There's not enough information for me to help you in the comments here. This is sounding like an X-Y problem (you're trying to solve problem X, have chosen solution Y, and are trying to make Y work). I'd encourage you to focus on the problem you're trying to solve rather than the solution you have.
    – Derek F
    Apr 20 at 15:45
  • ok no problem thanks for your help
    – Rick
    Apr 20 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.