• Kumar5
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 8
    Replies
Hi Team,

I am trying to update Territory field and Owner field on account when ever created get created or updated with the below code, 

The custom metadata has 10 records with count,territory and owner to assign.  The below logic is working for single record, but when i load 10 records the last one only getting update.

Could you please help me where i m wrong here 
public class AsAccountTerritory{
    
    Public static void assignRSETerritoryandOwner(List<Account> newList) {
        
        Map<string,string> ASTerritoryCountMap = new map<string,string>(); 
        Map<string,string> ASTerritoryAccountMap = new map<string,string>(); 
        Map<string,string> AccountTerritoryCount = new map<string,string>(); 
        List<string> rseTerritoryList = new List<string>();               
        Map<string,Account> UpdateAccountTerritorycountMap = new map<string,Account>(); 
        string territoryCount;
        
        list<Account> rseTerritoryAccountList = new List<account>();        
        Map<string,Account> UpdateAccountMap = new map<string,Account>();
        
        for(RSTerritory_Account__mdt rselist : [select id,count__c,Territory__c,Territory_Owner__c from AS_Territory_Account__mdt]){
            rseTerritoryCountMap.put(rselist.count__c,rselist.Territory__c);
            rseTerritoryAccountMap.put(rselist.Territory__c,rselist.Territory_Owner__c);  
            rseTerritoryList.add(rselist.Territory__c);             
        }
        
        TerritoryAccountList = [select id from account where Business_Unit__c = 'SMB BU' and Area__c = 'Americas' and Market__C = 'United States'  and Billing_Country__c = 'USA' and  leadscore = '20' and AS_Territory__c =: rseTerritoryList];
        
        integer  rseTerritoryAccountList1 = 10;        
        
        for(integer i =1;i<= newList.size(); i++){  
            for(Account accList : newList){       
                if(accList.LeadScore == '20' && accList.Billing_Country__c == 'USA'){
                    integer newaccountsizewithold  = rseTerritoryAccountList1 + i;
                    territoryCount = string.valueof(MATH.MOD(newaccountsizewithold,10));
                    
                    if(rseTerritoryCountMap.containskey(territoryCount)){                   
                        UpdateAccountTerritorycountMap.put(territoryCount,accList);
                        AccountTerritoryCount.put(territoryCount,territoryCount);
                        
                    }
                }
            }
        }
        
        for(Account accList : UpdateAccountTerritorycountMap.values()){
            if(accList.Leadscore == '20' && accList.Billing_Country__c == 'USA'){
                
                for(String terrcount : AccountTerritoryCount.keyset()){
                    
                    if(rseTerritoryCountMap.containskey(terrcount)){                    
                        UpdateAccountTerritorycountMap.get(terrcount).AS_Territory__c = rseTerritoryCountMap.get(terrcount); 
                        
                        
                        if(rseTerritoryAccountMap.containskey(UpdateAccountTerritorycountMap.get(terrcount).AS_Territory__c)){                    
                            UpdateAccountTerritorycountMap.get(terrcount).Ownerid = rseTerritoryAccountMap.get(UpdateAccountTerritorycountMap.get(terrcount).AS_Territory__c);
                        }
                        
                    }
                }   
                
            }
        }       
    }   
}
  • February 08, 2021
  • Like
  • 0
Wrapper class for mapping JSON Values
Hi Team,

I am workin on Webservices where i need to map json to salesforce. 

Please help me with the sample code for following json {
    "QuoteLineItem": [
        {
"REQ_ID": "055",
            "QUANTITY": "21168.000",
            "ITEM_UNIT_PRICE": "292.48",
            "REQ_PRICE_PER": "100",
            "STATUS": "8",
            "UOM": "PC",
            "CURRENT_PRICE": "292.48",
            "ITM_NUMBER": "000001",
            "CURRENT_PRICE_UOM": "PC",
            "MATERIAL": "5-103669-3"
        },
        {
            "REQ_ID": "055",
            "QUANTITY": "21168.000",
            "ITEM_UNIT_PRICE": "292.48",
            "REQ_PRICE_PER": "100",
            "STATUS": "8",
            "UOM": "PC",
            "CURRENT_PRICE": "292.48",
            "ITM_NUMBER": "000001",
            "CURRENT_PRICE_UOM": "PC",
            "MATERIAL": "5-103669-3"
        }
    ],
    "QuoteHeader": {
        "POS_REGION": "",
        "NET_VALUE": "0.00",
        "END_ACCT": "",
        "REC_VERSION": "02",
        "REQUESTOR_NAME": "",
        "REQUESTED_DATE": "00000000",
        "PARTDETAILS_CNT": "100",
        "REQUESTOR_EMAIL": "",
        "EFFECTIVE_DATE": "20160713",
        "BRANCH_ID": ""
    },

}



public class QuoteWrapper {


tried this the below one but getting Unknown field: QuoteWrapper.QuoteLineItem
public class QuoteWrapper {
    public class QuoteHeader{
        public String CUST_REF_NO {get; set;}
        public string SALES_OFFICE {get; set;}

        public Integer invoiceNumber {get; set;}
        public List<quotelinteitem> quotelinteList {get;set;}
      
    }
    
    Public Class quotelinteitem{
        Public String QUANTITY;
        
      }

    public List<QuoteHeader> QuoteList {get; set;}

}

Thanks,
Kumar
  • November 09, 2018
  • Like
  • 0
Hi Everyone,

I am having rerender issue on selected List. when i change the stage i want to rerender select list values of competiro columns, it should be read only for first two status and next two status that should be editable.  Appreciate your help in below scenario.
     
<apex:column headerValue="{!$ObjectType.case.fields.status.label}" headerClass="headerClass"> 
                
<apex:inputField value="{!case.status}" id="Case_STATUS"/>
                
<apex:actionSupport event="onchange" reRender="Competitors,Competitors" /> 
            
</apex:column>

 <apex:column headerValue="Competitor" styleClass="requiredInput"  > 
                
<div class="requiredInput">    
    
                    
<apex:outputPanel layout="block" styleClass="requiredBlock"  rendered="{!IF((case.status!= status1) && (case.status!= status2), true, false) }" />
                    
<apex:selectList id="Competitors" required="true" size="1" rendered="{!IF((case.status!= status1) && (case.status!= status2), true, false) }"
   value="{!case.Competitors__c}" >
     
     <apex:selectOptions value="{!CompetitorsPicklist}"/>
                   
</apex:selectList> 
                   
<apex:outputPanel id="CompReqd"/>
               
 </div>
        
<apex:outputField value="{!case.Competitors__c}" 
        rendered="{!IF((case.status!= status1) && (case.status!= status2), false, true) }" id="Competitors1"/>
                     
</apex:column>             

Thanks,
Kumar
Hi Everyone,

I am having rerender issue on selected List. when i change the stage i want to rerender select list values of competiro columns, it should be read only for first two status and next two status that should be editable.  Appreciate your help in below scenario.
     
<apex:column headerValue="{!$ObjectType.opportunity.fields.status.label}" headerClass="headerClass"> 
                
<apex:inputField value="{!case.status}" id="Case_STATUS"/>
                
<apex:actionSupport event="onchange" reRender="Competitors,Competitors" /> 
            
</apex:column>

 <apex:column headerValue="Competitor" styleClass="requiredInput"  > 
                
<div class="requiredInput">    
    
                    
<apex:outputPanel layout="block" styleClass="requiredBlock"  rendered="{!IF((case.status!= status1) && (case.status!= status2), true, false) }" />
                    
<apex:selectList id="Competitors" required="true" size="1" rendered="{!IF((case.status!= status1) && (case.status!= status2), true, false) }"
   value="{!case.Competitors__c}" >
     
     <apex:selectOptions value="{!CompetitorsPicklist}"/>
                   
</apex:selectList> 
                   
<apex:outputPanel id="CompReqd"/>
               
 </div>
        
<apex:outputField value="{!case.Competitors__c}" 
        rendered="{!IF((case.status!= status1) && (case.status!= status2), false, true) }" id="Competitors1"/>
                     
</apex:column>             

Thanks,
Kumar

Hi Team,
I am trying to catch  the exception message and record id, i  am  able to get both. But two different lines are gettting. Could you please help me to get in one line
 catch(DmlException e)          
        {
        Integer numErrors = e.getNumDml();
        for(Integer i=0;i<numErrors;i++) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, e.getDmlId(i));
        ApexPages.addMessage(msg);
        // errorMsg += msg;
        errorMsg =  ' [e] ' + msg;
        newpage = null;
        }


Thanks,
Kumar
Hi Team,
I am trying to catch  the exception message and record id, i  am  able to get both. But two different lines are gettting. Could you please help me with below
 catch(DmlException e)          
        {
        Integer numErrors = e.getNumDml();
        for(Integer i=0;i<numErrors;i++) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, e.getDmlId(i));
        ApexPages.addMessage(msg);
        // errorMsg += msg;
        errorMsg =  ' [e] ' + msg;
        newpage = null;
        }


Thanks,
Kumar
Hi Team,

please help me the rendering with two profiles first column should not availble for two profiles and secon should n


            
             <apex:column rendered="{!NOT (isProfile1 || isProfile2) }">
                <apex:facet name="header">Service </apex:facet>

                    <apex:inputField value="{!oppEnd_Date__c}" id="End_Date" style="width:130px" />

            </apex:column>
             <apex:column rendered="{!OR (!isProfile1 || !isProfile2) }">
                <apex:facet name="header" > Partner</apex:facet>

                    <apex:inputField value="{!opp.Partner__c}" id="Partner" style="width:130px"  />
                </div>
            </apex:column>

Thanks for your help in advance.

Thanks,
Kumar
Hi Team,

The  below validation rule is working for one user . but i want to add one more user can you pleease help me with that

$User.Id != '005300000020erI' 
&& 
ISNEW() 
&& 
(RecordTypeId = $Setup.ObjectRecordTypeIds__c.Case__RecordType__c 
&& 
ISBLANK(TEXT(status__c)) 
)

Thanks,
Kumar
  • January 24, 2018
  • Like
  • 0
Hi Team,

Could you please help me with below validation rule. i have to want inlcude two user ids..


AND(
RecordTypeId == $Setup.ObjectRecordTypeIds__c.Case_RecordType__c,
LEN( Subject) >250,
OR(
ISNEW(),
ISCHANGED(RecordTypeId)
),
!AND(ISNEW(), RecordTypeId == $Setup.ObjectRecordTypeIds__c.Case_RecordType__c,ISPICKVAL (Contact_Type__c , 'employee'), $User.Id = '0058000000', $User.Id = '0053000000'),
skipValidations__c = False
)

Thanks,
Kumar
  • January 12, 2018
  • Like
  • 0
Hi Team,

Please provide me any reference example to create lightning component to view my records and team records(based on selection of my/all the data has to refresh). 

Thanks,
Kumar
  • January 09, 2018
  • Like
  • 0
Hi Team,

Could you please let me know how to enable inline editing in lightning when it is redireting to lightning.force.com/one/one.app#/alohaRedirect/( which is visualforce page in classic).

Thanks,
Naresh
  • December 15, 2017
  • Like
  • 0
Hello All,

I am getting case notification from email service when i have set email Deliverability to all emails. 

Please let me know how to deactivate those notifications.

Thansk,
Kumar
  • December 08, 2017
  • Like
  • 0
Hi Team,

I am trying to create component for mobile and desktop. On mobile i want to show navigation  bar on Home page but not in desktop. Please let me know if any one has worked on this type.

Thanks,
Kumar  
  • March 02, 2017
  • Like
  • 0
OAUTH ErroR code 1800

Hi Team,


we are logging into salesforce through native mobile app and autharizing through connected APP. But  i am getting Ouath error if i keep the login page idle for more than 10 minutes.

 we need to show different error message if this issue happens. Please let me know if any one has came across this scenario.

Thanks,
Kumar
  • November 08, 2016
  • Like
  • 0
Hi Team,


we are logging into salesforce through native mobile app and autharizing through connected APP. But  i am getting Ouath error if i keep the login page idle for more than 10 minutes.

 we need to show different error message if this issue happens. Please let me know if any one has came across this scenario.

Thanks,
Kumar
  • November 08, 2016
  • Like
  • 0
Hello Team,

I want to update contact fields of phone ane email from associated account fields of phone and emal using onlcik java script buttong.

Please provide me few inputs to achieve this.

Thanks,
Kumar
Hello All,

I have created Vf page with two different tabs. I want to know how to  show it in edit page once the records are saved in tab1.

Can any one help me how to achieve it


below is the code :

<apex:page controller="ManageApplicationController" tabstyle="Account">
 
 <apex:tabPanel switchType="client" selectedTab="Student" id="theTabPanel">
        <apex:tab label="Studnet" name="name1" id="tabOne">
        
        <apex:form >
        <apex:repeat value="{!Manageapp}" var="item"> 
          <apex:pageBlock >
           <apex:pageBlockSection >
               <apex:inputField value="{!item.Std.Name}"/>
               <apex:inputField value="{!item.Std.stunumber__c}"/>  
           </apex:pageBlocksection>           
           </apex:pageBlock>
           </apex:repeat>
           <apex:commandButton Value="save" action="{!saveText}"/>

           </apex:form>
           
           </apex:tab>          
        
        <apex:tab label="Item" name="name2" id="tabTwo">content for tab two
    
 
 
 
 
        <apex:Form >
        <apex:repeat value="{!Manageapp}" var="item"> 
        <apex:pageBlock >
       
       <br></br>
        
           <apex:pageBlockSection >
               <apex:inputField value="{!item.Std.city__c}"/>
               
               <apex:inputField value="{!item.litem.Name}"/>
               <apex:inputField value="{!item.litem.Linetemnumber__c}"/>
           </apex:pageBlockSection>
           </apex:pageBlock>
           </apex:repeat>
           <apex:commandButton Value="save" action="{!saveText}"/>           

           
           
        </apex:form>   
      
      </apex:tab>
      </apex:tabPanel>
        
       
   
 </apex:page>


Class :

public class ManageApplicationController {

   

    public List<wrapperclass> ManageApp
        {
          get;
          set;
        }  
        
        
   
    
        
    public ManageApplicationController ()
        {
            ManageApp = new List<wrapperclass>();
            addfields();
        }     
        
        
            public PageReference addfields()
        {
            try
                {
                    ManageApp.add(new wrapperclass(new Student__c(),new Item__c()));   // Adding fields toVfpage when user click on Add Button.
                }
            catch(Exception e)
                {
                    ApexPages.addMessages(e);
                }
            return ApexPages.currentPage();
        }      

       public class wrapperclass   // wrapper class to handle multiple objects.
         {
             public student__c Std{get;set;}
             public Item__c litem{get;set;}
             public wrapperclass(Student__c Std,Item__c lit)
             {
                 this.std = Std;
                 this.litem = lit;
             }
         }
         
         
          public PageReference saveText() // this method for inserting records into multiple objects.
        {
            try
                {
                    List<student__c> listStudent = new List<student__c>();
                    List<Item__c> lineItem = new List<Item__c>();
                   for(wrapperclass item : ManageApp)
                    {
                            listStudent.add(item.Std);
                            lineItem.add(item.litem);   
                    }
                      if(listStudent.size() >  0 && lineItem.size() > 0)
                        upsert lineItem;    // Inserting records in to multiple objects
                        upsert listStudent;          
                }
            catch(Exception e)
                {
                    ApexPages.addMessages(e);
                }
            return ApexPages.currentPage();
        }







}


Thanks,
Kumar
  • September 13, 2015
  • Like
  • 0
Hello All,

I am creating Visual force page with tabpanel having two tabs contacts and opportunites. I want to  upsert the records using the id with first tab details.

Please help me with upsert method 

<apex:page Controller="panelController" showHeader="true">
<apex:form >
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:blue; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="name2" id="ContactTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">
         <apex:pageBlock title="ContactDetails"> 
         <apex:inputField value="{!confields.name}"/>
         <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.type}"/>
       
       <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.email}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord}"/>
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
        
         <apex:pageBlock title="OpportunityDetails"> 
         <apex:inputField value="{!oppfields.name}"/>
         <apex:inputField value="{!oppfields.status}"/>
         <apex:inputField value="{!oppfields.date}"/>
       

        
        <apex:pageBlock title="contactdetails">
       <apex:inputField value="{!confields.citizenship__c}"/>
         <apex:inputField value="{!confields.alliance__c}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord1}"/>
        </apex:tab>
        
         </apex:tab>
    </apex:tabPanel>
  </apex:form>
</apex:page>


Controllerpublic with sharing class panelController {

public Account accfields{get;set;}
public contact confields{get;set;}

public panelController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
    insert accfields;
    insert confields;
        return null;
    }
    
    Public PageReference SaveRecord1()
    {}
}

Thanks,
Kumar
 
  • September 12, 2015
  • Like
  • 0
Hello All,

I am creating Visual force page with tabpanel having two tabs contacts and opportunites. I want to  upsert the records using the id with first tab details.

Please help me with upsert method 

<apex:page Controller="panelController" showHeader="true">
<apex:form >
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:blue; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="name2" id="ContactTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">
         <apex:pageBlock title="ContactDetails"> 
         <apex:inputField value="{!confields.name}"/>
         <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.type}"/>
       
       <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.email}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord}"/>
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
        
         <apex:pageBlock title="OpportunityDetails"> 
         <apex:inputField value="{!oppfields.name}"/>
         <apex:inputField value="{!oppfields.status}"/>
         <apex:inputField value="{!oppfields.date}"/>
       

        
        <apex:pageBlock title="contactdetails">
       <apex:inputField value="{!confields.citizenship__c}"/>
         <apex:inputField value="{!confields.alliance__c}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord1}"/>
        </apex:tab>
        
         </apex:tab>
    </apex:tabPanel>
  </apex:form>
</apex:page>


Controllerpublic with sharing class panelController {

public Account accfields{get;set;}
public contact confields{get;set;}

public panelController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
    insert accfields;
    insert confields;
        return null;
    }
    
    Public PageReference SaveRecord1()
    {}
}

Thanks,
Kumar

 
  • September 12, 2015
  • Like
  • 0
Hi Team,

I want to populate account id  value into the field (BISM_Officer__c) of object Clarity_Effort__c. 

Below is the requirement in brief 
I have two objects Clarity and Account.  If any record is created with out BISM_Officer__c then, there is field Resource_Name__c in Clarity object and in Account there is field Clarity_Effort_Resource_Name__c if these two are matching, the accountId of value with Clarity_Effort_Resource_Name__c need to popualte in Clarity record. The below code is working  for single record, but not bulk records.

Would you please guide me with above requirement.


trigger  AccountPopulate on Clarity_Effort__c (before insert, before update) 
{

     String AccountId;

     Map<String,List<Clarity_Effort__c>> AccountClarityList = new Map <String,List<Clarity_Effort__c>>();
     
     
     List<Account>  AccountList = new List<Account> ();
     
    // List<Clarity_Effort__c> UpdateClarityList = new List<Clarity_Effort__c>();
     List<Clarity_Effort__c> NewClartiryList= new List<Clarity_Effort__c>();
     
     List<string> ClarityWithoutAccounts = new List<string>();
   
     for (Clarity_Effort__c  CE : Trigger.new) 
      
       {
     
          if (Trigger.isInsert || Trigger.isUpdate)
          {
           if(CE.BISM_Officer__c == null)
       
             {
                 ClarityWithoutAccounts.add(CE.Resource_Name__c);
                 NewClartiryList.add(CE);
                 
             } 
          }      
             
            system.debug( 'Naresh'+ ClarityWithoutAccounts);
            
                                     
       }       
       
        AccountList = [SELECT Id FROM Account WHERE Clarity_Effort_Resource_Name__c IN : ClarityWithoutAccounts];  
        

          for(Account Acc : AccountList) 
          
          
           {
              if(!AccountClarityList.containsKey(Acc.Id))
              
                  {
                
                     AccountClarityList.put(Acc.id, new List<Clarity_Effort__c>());
                     AccountClarityList.get(Acc.Id); 
                     AccountId= Acc.Id;  
                     
                  }
              
              system.debug('AccountListCL'+AccountClarityList);
              
            for (Clarity_Effort__c  CEU : NewClartiryList ) 
        
               {
          
                   CEU.BISM_Officer__c = AccountId;
                   // UpdateClarityList.add(CEU);
               }          
              

                 
           }                         
        
          
       
      
 }

Thanks,
Kumar
Hi Team,

please help me the rendering with two profiles first column should not availble for two profiles and secon should n


            
             <apex:column rendered="{!NOT (isProfile1 || isProfile2) }">
                <apex:facet name="header">Service </apex:facet>

                    <apex:inputField value="{!oppEnd_Date__c}" id="End_Date" style="width:130px" />

            </apex:column>
             <apex:column rendered="{!OR (!isProfile1 || !isProfile2) }">
                <apex:facet name="header" > Partner</apex:facet>

                    <apex:inputField value="{!opp.Partner__c}" id="Partner" style="width:130px"  />
                </div>
            </apex:column>

Thanks for your help in advance.

Thanks,
Kumar
Hi Team,

The  below validation rule is working for one user . but i want to add one more user can you pleease help me with that

$User.Id != '005300000020erI' 
&& 
ISNEW() 
&& 
(RecordTypeId = $Setup.ObjectRecordTypeIds__c.Case__RecordType__c 
&& 
ISBLANK(TEXT(status__c)) 
)

Thanks,
Kumar
  • January 24, 2018
  • Like
  • 0
Hi Team,

Could you please help me with below validation rule. i have to want inlcude two user ids..


AND(
RecordTypeId == $Setup.ObjectRecordTypeIds__c.Case_RecordType__c,
LEN( Subject) >250,
OR(
ISNEW(),
ISCHANGED(RecordTypeId)
),
!AND(ISNEW(), RecordTypeId == $Setup.ObjectRecordTypeIds__c.Case_RecordType__c,ISPICKVAL (Contact_Type__c , 'employee'), $User.Id = '0058000000', $User.Id = '0053000000'),
skipValidations__c = False
)

Thanks,
Kumar
  • January 12, 2018
  • Like
  • 0
Hi Team,

Could you please let me know how to enable inline editing in lightning when it is redireting to lightning.force.com/one/one.app#/alohaRedirect/( which is visualforce page in classic).

Thanks,
Naresh
  • December 15, 2017
  • Like
  • 0
Hello All,

I am getting case notification from email service when i have set email Deliverability to all emails. 

Please let me know how to deactivate those notifications.

Thansk,
Kumar
  • December 08, 2017
  • Like
  • 0
Hello All,

I am creating Visual force page with tabpanel having two tabs contacts and opportunites. I want to  upsert the records using the id with first tab details.

Please help me with upsert method 

<apex:page Controller="panelController" showHeader="true">
<apex:form >
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:blue; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="name2" id="ContactTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">
         <apex:pageBlock title="ContactDetails"> 
         <apex:inputField value="{!confields.name}"/>
         <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.type}"/>
       
       <apex:inputField value="{!confields.phone}"/>
         <apex:inputField value="{!confields.email}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord}"/>
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
        
         <apex:pageBlock title="OpportunityDetails"> 
         <apex:inputField value="{!oppfields.name}"/>
         <apex:inputField value="{!oppfields.status}"/>
         <apex:inputField value="{!oppfields.date}"/>
       

        
        <apex:pageBlock title="contactdetails">
       <apex:inputField value="{!confields.citizenship__c}"/>
         <apex:inputField value="{!confields.alliance__c}"/>
        </apex:pageblock>
         <apex:commandButton value="save" action="{!saveRecord1}"/>
        </apex:tab>
        
         </apex:tab>
    </apex:tabPanel>
  </apex:form>
</apex:page>


Controllerpublic with sharing class panelController {

public Account accfields{get;set;}
public contact confields{get;set;}

public panelController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
    insert accfields;
    insert confields;
        return null;
    }
    
    Public PageReference SaveRecord1()
    {}
}

Thanks,
Kumar
 
  • September 12, 2015
  • Like
  • 0