• Saurabh Rawat 14
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi All,

Im trying to work with multi layer maps and have never done so before.  

What i want to do is get Category as top KeySet then for each category a Contract Name, then for each contract name Value of Sales.  

Im iterating through sales for each Account and trying to add them to the maps or purge and replace to add $$ to the Value of Sales.

it doesnt seem to be working and i cant figure why.  Please advise thanks!
Map<String,Map<String,Decimal>> CategoryList = new Map<String,Map<String,Decimal>>();
    Map<String,Decimal> SubGroup = new Map<String,Decimal>();
    Map<String,Map<String,Decimal>> TierList = new Map<String,Map<String,Decimal>>();
    Map<String,Decimal> TierSubGroup = new Map<String,Decimal>();
    

if(!CategoryList.keyset().contains(RelatedSale.Product_Group__c)){
                                SubGroup.put(RelatedSale.Related_Contract__r.External_Contract_Name__c, RelatedSale.Amount__c);
                                CategoryList.put(RelatedSale.Product_Group__c, SubGroup);
                                SubGroup.clear();
                            }
                            if(!TierList.keySet().contains(RelatedSale.Product_Group__c)) {
                            	TierSubGroup.put(RelatedSale.Related_Contract__r.Contract_Tier__c, RelatedSale.Amount__c);
                                TierList.put(RelatedSale.Product_Group__c, TierSubGroup);
                                TierSubGroup.clear();
                            }
                            if(CategoryList.keyset().contains(RelatedSale.Product_Group__c)) {
                                if(CategoryList.get(RelatedSale.Product_Group__c).keyset().contains(RelatedSale.Related_Contract__r.External_Contract_Name__c)) {
                                	UpdateAmount = CategoryList.get(RelatedSale.Product_Group__c).get(RelatedSale.Related_Contract__r.External_Contract_Name__c) + RelatedSale.Amount__c;
                                    CategoryList.get(RelatedSale.Product_Group__c).remove(RelatedSale.Related_Contract__r.External_Contract_Name__c);
                                    CategoryList.get(RelatedSale.Product_Group__c).put(RelatedSale.Related_Contract__r.External_Contract_Name__c, UpdateAmount);
                                }
                                if(!CategoryList.get(RelatedSale.Product_Group__c).keyset().contains(RelatedSale.Related_Contract__r.External_Contract_Name__c)) {
                                    CategoryList.get(RelatedSale.Product_Group__c).put(RelatedSale.Related_Contract__r.External_Contract_Name__c, RelatedSale.Amount__c);
                                }
                            }
                            if(TierList.keyset().contains(RelatedSale.Product_Group__c)) {
                            	if(TierList.get(RelatedSale.Product_Group__c).keyset().contains(RelatedSale.Related_Contract__r.Contract_Tier__c)) {
                                	UpdateAmount = TierList.get(RelatedSale.Product_Group__c).get(RelatedSale.Related_Contract__r.Contract_Tier__c) + RelatedSale.Amount__c;
                                    TierList.get(RelatedSale.Product_Group__c).remove(RelatedSale.Related_Contract__r.Contract_Tier__c);
                                    TierList.get(RelatedSale.Product_Group__c).put(RelatedSale.Related_Contract__r.Contract_Tier__c, UpdateAmount);
                                }
                                if(!TierList.get(RelatedSale.Product_Group__c).keyset().contains(RelatedSale.Related_Contract__r.Contract_Tier__c)) {
                                    TierList.get(RelatedSale.Product_Group__c).put(RelatedSale.Related_Contract__r.Contract_Tier__c, RelatedSale.Amount__c);
                                }	   
                            }

 
Hi,
I have a custom field called Type of picklist (picklist values are same as off type values on account object).
I need to get all the contacts related to account and auto update the Type field on contact object with a value same as off to that account..

I tried the following code ,it is not showing any errors but my field on contact is not updating.

Can anyone hlepme to solve the issue ?
Apex Class:
public class UpdatingtypefieldonContact {
    public Map<list<Account>,list<Contact>> maplist{get;set;}// getting list of id(accounts) and values(contacts) //
    list<Contact> updatedlist{get;set;}
    public void updatetypefield()
    {
      maplist=new Map<list<Account>,list<Contact>>();
       list<Account> accountlist=new list<Account>();
       list<Contact> contactlist=new list<Contact>();
       list<Contact> updatedlist=new list<Contact>(); // list after updating type field//
       accountlist=[select id,name,Type from Account];
         contactlist=[select id,name,Accountid,Type__c from Contact where Accountid in:accountlist]; 
        maplist.put(accountlist,contactlist);
       // system.debug(maplist);//
           for(Account aa:accountlist)
           {
          for(Contact cc:contactlist)
          {
            if(cc.Type__c=='null')
             {
                  cc.Type__c=aa.Type;
                 updatedlist.add(cc);
              }
          }
        }
        update updatedlist;
        maplist.put(accountlist,updatedlist);
        system.debug(maplist);
     }
}

 
I'm experiencing a strange problem that cropped up yesterday morning.  I am suddenly getting a 'page not found' error when trying to access my community in my sandbox org.  I have not changed any of the custom URL settings in weeks and was accessing and using the sandbox community the very night before without issue.

Sandbox: https://sandbox-hirebotics.cs51.force.com/ (<-- page not found error)

Production:  https://robots.hirebotics.com (<-- works fine)

After three phone calls / go-to-meetings with salesforce support they can't figure out what's going on.  Their latest guess is that my product custom URL in sandbox (which is copied into sandbox upon a refresh, which I haven't done in a week) is set to "in development".  But they can't tell me why that's a problem now nor how to change that, assuming that's the problem.  They suggested I post here.  See below.
Custom URL in Sandbox

Now, I also tried spinning out another developers sandbox from my working production org and I'm seeing the exact same problem accessing the login page hosted from this new dev org.

Note that the error page below is being served from my org as the email us link connects to my email address.
Community Error Page

Also, both my sandbox and dev sandbox are hosted on CS51, if that's relevant.

Any idea what's going on?  
 
Hi,
I have a custom field called Type of picklist (picklist values are same as off type values on account object).
I need to get all the contacts related to account and auto update the Type field on contact object with a value same as off to that account..

I tried the following code ,it is not showing any errors but my field on contact is not updating.

Can anyone hlepme to solve the issue ?
Apex Class:
public class UpdatingtypefieldonContact {
    public Map<list<Account>,list<Contact>> maplist{get;set;}// getting list of id(accounts) and values(contacts) //
    list<Contact> updatedlist{get;set;}
    public void updatetypefield()
    {
      maplist=new Map<list<Account>,list<Contact>>();
       list<Account> accountlist=new list<Account>();
       list<Contact> contactlist=new list<Contact>();
       list<Contact> updatedlist=new list<Contact>(); // list after updating type field//
       accountlist=[select id,name,Type from Account];
         contactlist=[select id,name,Accountid,Type__c from Contact where Accountid in:accountlist]; 
        maplist.put(accountlist,contactlist);
       // system.debug(maplist);//
           for(Account aa:accountlist)
           {
          for(Contact cc:contactlist)
          {
            if(cc.Type__c=='null')
             {
                  cc.Type__c=aa.Type;
                 updatedlist.add(cc);
              }
          }
        }
        update updatedlist;
        maplist.put(accountlist,updatedlist);
        system.debug(maplist);
     }
}