• Manish Tripathi 20
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies
I have to built custom record detail page ,same as standard like having inline editing with pencil icon and save functionality as standard has using LWC .

The Main Issue I am facing here is , to divide field in sections. I used form tag but didnt worked, Might took wrong approach.
Can anyone help me on this urgent basis.
User-added image
public class ShowAllOpportunityAMountTOAccount {
    
    public static void getOpportunities(List<Opportunity> opportunityList){
        set<ID> setOFAccId=new set<ID>();
        for(Opportunity opp:opportunityList){
            setOFAccId.add(opp.AccountId);
        }
        Map<ID,Opportunity> mapOFOpp=new Map<Id,Opportunity>();
        List<Opportunity> opplist=[select id,Name,AccountId,Amount from Opportunity  where AccountID IN:setOFAccId ORDER BY Name DESC];
        for(Opportunity op:opplist){
            mapOFOpp.put(op.AccountId,op); 
        }
        //  system.debug(''+mapOFOpp[0].get(o.Amount););
        list<Opportunity> oplist=new List<Opportunity>();
        for(Opportunity o:opportunityList){
            Account acc=new Account();
            acc.Id=o.AccountId;
            acc.Opp1_Amount__c=mapOFOpp[0].get(o.Amount);
            acc.Opp2_Amount__c=mapOFOpp[1].get(o.Amount);
            acc.Opp3_Amount__c=mapOFOpp[2].get(o.Amount);
        }
    }
}

Error: Expression must be a list type: Map<Id,Opportunity>
I have Master list holding All those contact data having email is null.I want to keep only one record from this list and then i have to delete this list . I applied with for each loop on this master lish so that i can get one record and and in one list and delete master ,but it is giving me error that 
System.ListException: Duplicate id in list: 0035g000008iqPAAAY
, how can I achieve this.
User-added image
I have a map in which I stored String vs List of Contact , and Now I am iterating over this map , on keyset. In inner for loop I am trying to add all values(Contacts) associated to a single key in a list, so that I can seperate contacts with email and without email in two lists ,but for-each loop works on single records , so I am trying to use counter ,so that I can identify values count and index, so that I can compare but not able to acheive this , Any help.
Main purpose is to merge duplicate contacts. 

   for(String cc:mapContact.KeySet()){
            Integer i=0;
            If(mapContact.get(cc).size()>0){
            for(Contact con:mapContact.get(cc)){
                if(con.Email!=null){
                    ccWithEmail.add(con);
                i++;
            }
            }
        }
I have one custom multi-select field on contact , I am importing data using CSV file via Data import wizard , but in CSV there are many values which not lies in the picklist field. There is a checkbox is marked true while create multi select field i.e "Restrict picklist to the values defined in the value set=true" which is not editable. so I am not able to import all data which value not exist in picklist value from csv.
How can we do this ?
*Picklist field created using global picklist value sets.
I am not able to update the sales cloud filed dynamically from the marketing cloud using amp script on the landing page.

%%[

/* SET @emailAddress = requestparameter("Email") */
set @SubKey= 'a0Q2w0000033pY9EAI'
/*set @SubKey= requestparameter("BUI_RecordID")*/
set @jid= requestparameter("jobid")
set @listid= requestparameter("listid")

 SET @lue = CreateObject("ExecuteRequest")
 SetObjectProperty(@lue,"Name","LogUnsubEvent")

 SET @lue_prop = CreateObject("APIProperty")                 
 SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
 SetObjectProperty(@lue_prop, "Value", @SubKey)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "JobID")
 SetObjectProperty(@lue_prop, "Value", @jid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "ListID")
 SetObjectProperty(@lue_prop, "Value", @listid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

/*
 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "BatchID")
 SetObjectProperty(@lue_prop, "Value", @batchid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)
*/

 SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

 SET @Response = Row(@lue_statusCode, 1)
 SET @Status = Field(@Response,"StatusMessage")
 SET @Error = Field(@Response,"ErrorCode")

  
    IF LENGTH(@SubKey) == 18 AND IndexOf(@SubKey, "@") == 0 THEN
      /*  SET @updateRecord = UpdateSingleSalesforceObject("Contact", @SubKey, "HasOptedOutOfEmail", 0)*/
        SET @updateRecord = UpdateSingleSalesforceObject("abc__c", "a0Q2w0000------", "Name","Test")
        SET @updateRecord = UpdateSingleSalesforceObject("abc__c", "a0Q2w000-------", "Opt_Out__c", "true")
        
        
    ENDIF
]%%
public class AccountSelectContact{
    public List<WrapAccount> wrapAccList{get;set;}
    public List<Account> selectedAccounts{get;set;}
    public List<Contact> conList{get;set;}
    public AccountSelectContact(){
        if(wrapAccList== null){
            wrapAccList= new List<WrapAccount>();
          List<Account> accList=[select id, name,(select id,name,phone from contacts) from Account];
            for(Account a: accList){
                wrapAccList.add(new WrapAccount(a));
            }
        }
        system.debug('wrapAccList++'+wrapAccList);
    }
    public void processSelected(){
        wrapAccList= new List<WrapAccount>();
        selectedAccounts= new List<Account>();
        conList=[select id,name,phone from Contact where id IN: accList];
        for(WrapAccount w:conList){
            if (w.selected==true){
              selectedAccounts.add(w.conList);
            }
        }
    }
    public class WrapAccount{
        public Account acc{get;set;}
        public Boolean selected{get;set;}
        public WrapAccount(Account a){
            this.acc=a;
            this.selected=false;
        }
    }
}
public class ShowAllOpportunityAMountTOAccount {
    
    public static void getOpportunities(List<Opportunity> opportunityList){
        set<ID> setOFAccId=new set<ID>();
        for(Opportunity opp:opportunityList){
            setOFAccId.add(opp.AccountId);
        }
        Map<ID,Opportunity> mapOFOpp=new Map<Id,Opportunity>();
        List<Opportunity> opplist=[select id,Name,AccountId,Amount from Opportunity  where AccountID IN:setOFAccId ORDER BY Name DESC];
        for(Opportunity op:opplist){
            mapOFOpp.put(op.AccountId,op); 
        }
        //  system.debug(''+mapOFOpp[0].get(o.Amount););
        list<Opportunity> oplist=new List<Opportunity>();
        for(Opportunity o:opportunityList){
            Account acc=new Account();
            acc.Id=o.AccountId;
            acc.Opp1_Amount__c=mapOFOpp[0].get(o.Amount);
            acc.Opp2_Amount__c=mapOFOpp[1].get(o.Amount);
            acc.Opp3_Amount__c=mapOFOpp[2].get(o.Amount);
        }
    }
}

Error: Expression must be a list type: Map<Id,Opportunity>
public class AccountSelectContact{
    public List<WrapAccount> wrapAccList{get;set;}
    public List<Account> selectedAccounts{get;set;}
    public List<Contact> conList{get;set;}
    public AccountSelectContact(){
        if(wrapAccList== null){
            wrapAccList= new List<WrapAccount>();
          List<Account> accList=[select id, name,(select id,name,phone from contacts) from Account];
            for(Account a: accList){
                wrapAccList.add(new WrapAccount(a));
            }
        }
        system.debug('wrapAccList++'+wrapAccList);
    }
    public void processSelected(){
        wrapAccList= new List<WrapAccount>();
        selectedAccounts= new List<Account>();
        conList=[select id,name,phone from Contact where id IN: accList];
        for(WrapAccount w:conList){
            if (w.selected==true){
              selectedAccounts.add(w.conList);
            }
        }
    }
    public class WrapAccount{
        public Account acc{get;set;}
        public Boolean selected{get;set;}
        public WrapAccount(Account a){
            this.acc=a;
            this.selected=false;
        }
    }
}