• Raj88
  • NEWBIE
  • 55 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 11
    Replies
Hi,

I am using a conga composer and generating the reports data using powerpoint. My scenario is i have a table which fetches all opportunity name and other fields to that table. i have more than 30 opportunities, so the table is seperated and showing in 2 or 3 different slides. i need to show all the opportunities in same page with scrollbar in the table within the same slide. Is this possible?

User-added image
User-added image

Need to show like this

User-added image

Thanks
Vivekh
  • December 24, 2015
  • Like
  • 0
Hi,
I enabled my lightning experience in my developer sandbox. after that i tried to login to my account it is not allowing me to login. i was getting this error,

User-added image

Thanks
Vivek
  • December 09, 2015
  • Like
  • 0
How to check my values using debug logs statement in Test class..Here is my test class code

Test class:
static testmethod void test_1(){
           Account acc= new Account();
           acc.Name='Test';
           acc.Type='Customer';
           insert acc;
           
           Contact con = new Contact();
           con.LastName='TestUser';
           con.Email='testUser@test.com';
           con.AccountId=acc.id;
           insert con ; 
           
           opportunity opty = new opportunity();
           opty.Name='test';
           opty.CloseDate=system.today();
           opty.StageName='Advanced';
           opty.AccountId=acc.id;
           opty.Customer_Contact__c=con.id;
           insert opty;
           system.debug('opp' +opty);
        Test.startTest();
        ApexPages.StandardController sc = new ApexPages.StandardController(opty);
        oppexstn testoppexstn = new oppexstn(sc);
        Test.stopTest();
        }

I cant find this debug log text 'opp' in my debug logs statement.

Thanks
Raj
  • July 23, 2015
  • Like
  • 0
Hi,
I need to update an inputfield based on the values entered in VF page. I can see the values in my debug logs but those values are not storing in my textbox after saving. This is my code.

Class:
Set<Status__c> setId = new Set<Status__c>();
List<Status__c> OppToUpsert = new List<Status__c>(); 
Opportunity_Gaps_Status__c acc = new Opportunity_Gaps_Status__c();        
for (OppWrapper avar : OppWrappersList)
  {
    if(selectedtext == 'update field')
            {
                    setId.add(avar.acc); 
                    OppToUpsert.addAll(setId); 
            }
    }
upsert OppToUpsert;

VF page:
<apex:repeat value="{!OppList}" var="a">
    <tr>
          <td>{!a.acc.Name__c}</td>
          <td><apex:InputField value="{!a.acc.Updates__c}" id="selectedtext"/></td>
    </tr>       
</apex:repeat>

Can anyone help me. Thanks in advance.
  • July 20, 2015
  • Like
  • 0
I am getting this error "DML requires SObject or SObject list type: Set<Status__c>  " when i tried to save the class. This is my code.

Apex Class:
        List<Status__c> OpprtyToUpsert = new List<Status__c>(); 
        Set<Status__c> OpprtyToset = new Set<Status__c>(); 
        Status__c acc = new Status__c();
        for (OppWrapper avar : OppWrappersList )
        {
            if (avar.UpdatePrev == True)
                {
                   if (avar.acc.id != null)               
                       {                
                           avar.acc.Satisfied_By_Previous_Deal__c = true;
                           OpprtyToUpsert.add(avar.acc); 
                           OpprtyToset.addAll(OpprtyToUpsert); 
                       }
                }
             else if (avar.UpdateSta == True)
                {
                    if (avar.acc.id != null)               
                        {
                            avar.acc.Current_Status__c = selectestatus;
                            OpprtyToUpsert.add(avar.acc);
                            OpprtyToset.addAll(OpprtyToUpsert); 
                        }
                }
        }
    upsert OpprtyToset;

I am getting duplicate id error when i tried to update the records so i converted List to Set and tried to update. But i cant save the class it is showing the above error. Can anyone help me? Thanks in advance.
  • July 12, 2015
  • Like
  • 0
I need to show some more fields while mousehover in my VF page. Here is my code

VF:
<td><div class="progress" style="width: {!progress}%;">
                                <a id="{!opp.Id}" href="{progress}" 
                                onmouseover="LookupHoverDetail.getHover('{!opp.id}', '/{!opp.Id}/m?retURL={!opp.Id}&isAjaxRequest=1').show();" 
                                onmouseout="LookupHoverDetail.getHover('{!opp.Id}').hide();"
                                onfocus="LookupHoverDetail.getHover('{!opp.Id}', '/{!opp.Id}/m?retURL={!opp.Id}&isAjaxRequest=1').show();"
                                onblur="LookupHoverDetail.getHover('{!opp.Id}').hide();">{!progress}%
                                </a>
</div></td>
Currently Opportunity field is only visible when i hover the mouse. I need to show other fields like Stage,Name, etc
  • July 12, 2015
  • Like
  • 0
I need to fetch records based on multiple pickl;ist value i have selected. 
This is my VF page.


       <apex:pageBlock> 
            <apex:pageBlockSection >
                <apex:outputLabel> Account Filter: &nbsp;
                    <apex:selectList value="{!selectedList}" size="5" id="AccountFilter" multiselect="true">
                        <apex:selectOptions value="{!selectList1}"/>
                        <apex:actionSupport action="{!loadDetails}" event="onclick" reRender="AccDMLTable"/>    
                    </apex:selectList>
                </apex:outputLabel> 
            </apex:pageBlockSection>              
            <apex:pageBlockSection > 
                <apex:outputLabel > Status Filter: &nbsp;
                    <apex:selectList value="{!selectedstList}" id="StatusFilter" size="5" multiselect="true">
                        <apex:selectOptions value="{!selectList2}"/>
                        <apex:actionSupport action="{!loadDetails}" event="onclick" reRender="AccDMLTable"/>
                    </apex:selectList> 
                </apex:outputLabel>    
            </apex:pageBlockSection>
      </apex:pageBlock>
    <apex:pageBlock>
        <table class="display" border= "1" id="AccDMLTable">
         <apex:repeat value="{!OppList}" var="a" id="AccDMLTable">
         <tr>
          <td>{!a.acc.Name}</td>
            <td>{!a.acc.Status}</td>
            <<td>{!a.acc.LastModifiedDate}</td>
         </tr>
         </apex:repeat>
         </table>
        <apex:commandButton value="Save" action="{!SaveAcc}" reRender="AccDMLTable"/>     
    </apex:pageBlock>
  • July 08, 2015
  • Like
  • 0
I need to show all the custom object records in pageblocktable. Before populating all the records i need to add a picklist value, Checkbox in the first row and then populate all the records. How can i do that. Here is the screenshot and VF code and class.

User-added image

VF code:
<apex:page standardcontroller="Opportunity" extensions="oppgapstatus">
<apex:form>
<apex:pageBlock> 
<apex:pageBlockSection id="Info">
<apex:pageBlockTable value="{!WrapperList}" var="wraprec">
<apex:column value="{!wraprec.accRec.Name__c}"/>
<apex:column value="{!wraprec.accRec.Satisfied__c}"/>  
<apex:column value="{!wraprec.accRec.Current_Status__c}"/>
<apex:column value="{!wraprec.accRec.LastModifiedDate}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandbutton value="Save" action="{!UpdateSelectedRecords}"/>
<apex:commandbutton value="Cancel"/>
</apex:pageBlock>
</apex:form>
</apex:page>

Apex class:
Public class oppgapstatus{
 Public Opportunity optyList{get;set;}
 Public Opportunity_Status__c opst{get;set;}
  public PageReference openPresentationOptions() {
      return null;
   }
   
 private ApexPages.StandardController controller;
 public oppgapstatus(ApexPages.StandardController controller) {
 }
//Checkbox selectall        
Public List<wrapperclass> wrapList {get;set;}
Public boolean checked{get;set;}
Public string selectedField {get;set;}
Public string inputVal{get;set;}
  Public void selectallnone(){
    if(!checked)
      checked = true;
    else
      checked = false;

 }
  Public List<wrapperclass> getWrapperList(){
   wrapList = New List<wrapperclass>();
   for(Opportunity_Status__c acc:[select name,Satisfied__c,Current_Status__c,LastModifiedDate from Opportunity_Gaps__c where Opportunity_Detail__c =: optyList.Id]){
     if(!checked)
     wrapList.add(New wrapperclass(acc,false)); 
     else
     wrapList.add(New wrapperclass(acc,true));   
   } 
   return wrapList; 
  }
   Public class wrapperclass{
   Public Opportunity_Status__c accRec{get;set;}
   Public boolean checkFlag{get;set;}
    
   Public wrapperclass(Opportunity_Status__c acc,boolean flag){
    accRec = acc;
    checkFlag = flag;
    }
   }

Can anyone help me.? Thanks in advance
  • June 29, 2015
  • Like
  • 0
I want to create a table in my VF page, shown below. I tried 'colspan' for seperating a column but that was not working. Any other solution will be much appreciated. Thanks in advance.

My VF page:
<apex:page standardcontroller="Opportunity" extensions="opp">
 <apex:form >
 <apex:pageBlock >
  <apex:pageBlockSection >  
  <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Account" />
                        <apex:outputText value="{!accName}" />
  </apex:pageBlockSectionItem> 
  <br/>
  <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Opportunity" />
                        <apex:outputText value="{!optyName}" />
  </apex:pageBlockSectionItem>
  <br/>
  <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Owner" />
                        <apex:outputText value="{!userName}" />
  </apex:pageBlockSectionItem>
  </apex:pageBlockSection>   
<br/>
<apex:dataTable value="{!oppgap}" var="opp" cellPadding="6" border="1" rows="3" columns="5">
<apex:column >
        <apex:facet name="header"></apex:facet>
</apex:column>
<apex:column >
        <apex:facet name="header">T1</apex:facet>
        <apex:outputLabel value="T1.1"/>
</apex:column>
<apex:column colspan="2">
        <apex:facet name="header">T2</apex:facet>
        <apex:outputText>T2.1</apex:outputText>
        <apex:outputText>T2.2</apex:outputText>
</apex:column>
<apex:column colspan="3">
        <apex:facet name="header">T3</apex:facet>
         <apex:outputText>T3.1</apex:outputText>
        <apex:outputText>T3.2</apex:outputText>
       <apex:outputText>T3.3</apex:outputText>
</apex:column>
</apex:dataTable>                 
</apex:pageBlock>
</apex:form>
</apex:page>

User-added image
  • June 22, 2015
  • Like
  • 0
I have 2 picklist values in a custom VF page. Finance__c and Type__c. If i select a value in Finance the Type__c picklist should become mandatory field. If i select the other value in Finance the Type__c picklist value should not be mandatory field. How can we achieve this using VF page.? Can anyone help me with this?

User-added image
User-added image
  • March 13, 2015
  • Like
  • 0
Hi,

I have an Custom object 'Price__c' and an standard object 'Contact'. When an custom  object 'Price__c' is created, 'Contact' object is also created. My question is when we delete the 'Contact' record the corresponding 'Price__c' object record must also be get deleted. Both are not related to each other but they have 'Account' object as lookup fields in both object.

I am new to coding part can someone help me.

Code:
trigger DeleteContact on Contact (before delete) {
if(Trigger.isDelete) {
for(Contact c: Trigger.old) {
Account acc = [select id from Account];
Price__c mpe =  [Select Id,Name,Account__r.Name From Price__c where id =: acc.id];
Contact con = [Select Id,Name,Contact.Account.Name From Contact where id =: acc.id];
delete con;
}
}
  • May 09, 2014
  • Like
  • 0
Need help in writing trigger.
I have a custom object 'MPEContact__c' is associated with Account and an standard object 'Contact'. If i delete the Contact record, the record associated with 'MPEContact__c' object should also be deleted.

My Code:

trigger updateContactMpe on MPEContact__c (after update) {

    Set<Id> accountId = new Set<Id>();
    Set<Id> empAppId = new Set<Id>();
    Set<String> ctxType;
    List<Contact> contactUpdateList = new List<Contact>();
    Map<String,MPEContact__c> mapContact = new Map<String,MPEContact__c>();
    Map<String,Contact> accContact = new Map<String,Contact>();
    Map<String,Contact> conUpdMap = new Map<String,Contact>();
  
    Schema.DescribeSObjectResult CONT_RT = Schema.SObjectType.Contact;
    Map<String,Schema.RecordTypeInfo> CONT_RTMapByName = CONT_RT.getRecordTypeInfosByName();
    Schema.RecordTypeInfo MPE_PART_CON_NAME = CONT_RTMapByName.get('MPE Partner Contact');
    Id PART_CON_RTId = MPE_PART_CON_NAME.getRecordTypeId();
  
  
try{
    for(MPEContact__c mpContact: trigger.new)
    {
        if(mpContact.Account__c!=null && mpContact.Application__c!=null && mpContact.EMail__c!=null)
        {
                accountId.add(mpContact.Account__c);
                empAppId.add(mpContact.Application__c);
                mapContact.put(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase(),mpContact);
        }
    }

    List<Empower_Application__c> empApp = new List<Empower_Application__c>();
    if(accountId.size()>0)
        empApp= [Select  Id,Application_Status__c from Empower_Application__c where Id in :empAppId and Application_Status__c in ('Transition Completed','Approved')];
  
    if(empApp.size()>0){
        if(accountId.size()>0){
            List<Contact> theContact = [Select Id, AccountId, firstName, lastName, Email, Phone, Title, MailingStreet, MailingCity, MailingState,
                                               MailingPostalCode, MailingCountry, MobilePhone, Salutation, Technolgy_Preference__c,
                                               Contact_Type__c, Primary_Contact_Type__c, Vertical_Market_Preference__c, Preferred_Language__c
                                          From Contact Where Accountid in :accountId];
          
            if(theContact.size()>0){
                for(Contact con : theContact)
                {
                    if(con.Email != null && mapContact.containsKey(con.lastName.toLowerCase()+'-'+con.Email.toLowerCase())) {
                        accContact.put(con.lastName.toLowerCase()+'-'+con.Email.toLowerCase(),con);
                    }
                }
            }
        }
      
        for(MPEContact__c mpContact: trigger.new)
        {
          
            if(mpContact.Account__c!=null && mpContact.Application__c!=null && mpContact.EMail__c!=null)
            {
              
                Contact cont;
                ctxType = new Set<String>();
              
                if (mpContact.Secondary_Role__c != null){
                    ctxType = new Set<String> (mpContact.Secondary_Role__c.split(';'));
                }
              
                if(accContact.containsKey(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()) &&
                   !conUpdMap.containsKey(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase())) {
                  
                    cont = new Contact(Id=accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Id,
                                       Primary_Contact_Type__c=accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Primary_Contact_Type__c,
                                       Contact_Type__c=accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Contact_Type__c,
                                       LastName=accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).LastName,
                                       Email=accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Email);                                      
                  
                    if(cont.Primary_Contact_Type__c == null || cont.Primary_Contact_Type__c.trim() == ''){
                        cont.Primary_Contact_Type__c = mpContact.Primary_Role__c;
                    } else {
                        ctxType.add(mpContact.Primary_Role__c);
                    }
                  
                    if(cont.Contact_Type__c == null || cont.Contact_Type__c.trim() == ''){
                        cont.Contact_Type__c = mpContact.Secondary_Role__c;
                    } else {                                              
                        if(mpContact.Secondary_Role__c != null && ctxType.size()>0){
                            for(String sc : ctxType){
                                if(!accContact.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Contact_Type__c.contains(sc)){
                                    cont.Contact_Type__c = cont.Contact_Type__c + ';' + sc;
                                }
                            }
                        }
                    }                  
                     
                }
              
                if(conUpdMap.containsKey(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase())){

                  cont = new Contact(Id=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Id,
                                       Primary_Contact_Type__c=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Primary_Contact_Type__c,
                                       Contact_Type__c=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Contact_Type__c,
                                       LastName=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).LastName,
                                       Email=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Email,                                     
                                       Tag__c=conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Tag__c);
                                     

                    if(cont.Primary_Contact_Type__c == null || cont.Primary_Contact_Type__c.trim() == ''){
                        cont.Primary_Contact_Type__c = mpContact.Primary_Role__c;
                    } else {
                        ctxType.add(mpContact.Primary_Role__c);
                    }
                  
                    if(cont.Contact_Type__c == null || cont.Contact_Type__c.trim() == ''){
                        cont.Contact_Type__c = mpContact.Secondary_Role__c;
                    } else {
                        if(mpContact.Secondary_Role__c != null && ctxType.size()>0){
                            for(String sc : ctxType){
                                if(!conUpdMap.get(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()).Contact_Type__c.contains(sc)){
                                    cont.Contact_Type__c = cont.Contact_Type__c + ';' + sc;
                                }
                            }
                        }
                    }
                  
                }
              
                if(!accContact.containsKey(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase()) &&
                   !conUpdMap.containsKey(mpContact.Last_Name__c.toLowerCase()+'-'+mpContact.Email__c.toLowerCase())) {
                    cont = new Contact();
                    cont.Primary_Contact_Type__c = mpContact.Primary_Role__c;
                    cont.Contact_Type__c = mpContact.Secondary_Role__c;
                    cont.Email=mpContact.Email__c;
                    cont.LastName = mpContact.Last_Name__c;                  
                }
              
                cont.AccountId = mpContact.Account__c;
                cont.FirstName = mpContact.First_Name__c;

                cont.First_Name_Local_Language__c = mpContact.First_Name_Local_Language__c;
                cont.Last_Name_Local_Language__c = mpContact.Last_Name_Local_Language__c;
                cont.Phone = mpContact.Phone__c;
                cont.Fax=mpContact.Fax__c;
                cont.MobilePhone=mpContact.Mobile__c;
                cont.MailingPostalCode=mpContact.Postal_Code__c;
                cont.Preferred_Language__c=mpContact.Primary_Language__c;              
                cont.Salutation=mpContact.Salutation__c;
                cont.MailingState=mpContact.State__c;
                cont.MailingCountry = mpContact.Country__c;
              

                cont.RecordTypeId=PART_CON_RTId;
              

              
                if(mpContact.Authorized_Partner_Admin__c){
                    cont.Tag__c ='SFDC Partner Admin';
                }
              
                if (mpContact.Street_Address2__c != null) {
                    cont.MailingStreet = mpContact.Street_Address1__c+' '+mpContact.Street_Address2__c;
                } else {
                    cont.MailingStreet=mpContact.Street_Address1__c;
                }
              
                cont.Technolgy_Preference__c=mpContact.Technolgy_Preference__c;
                cont.Title=mpContact.Title__c;
                cont.Vertical_Market_Preference__c=mpContact.Vertical_Market_Preference__c;
                cont.MailingCity=mpContact.City__c;
              
                conUpdMap.put(cont.LastName.toLowerCase()+'-'+cont.Email.toLowerCase(),cont);
                              
            }
        }
    }
  
    if(conUpdMap.size()>0){
        contactUpdateList = conUpdMap.values();
    }
  
    if(contactUpdateList.size()>0){
        upsert contactUpdateList;
    }
      
}
catch(Exception e)
    {
        String objectName ='MPEContact__c';
        String userName=userInfo.getName();
        datetime myDateTime = datetime.now();
        CreateErrorLog.createErrorRecord(e.getmessage(),objectName,e.getStackTraceString(),userName,myDateTime,e.getTypeName());
    }

}
  • May 07, 2014
  • Like
  • 0
Trigger:

trigger trg_insertdeal on DealProduct__c (after insert)
{
    List <DealProduct__c> dplist = new List <DealProduct__c >();
     map<id,Deals__c> mapDeal = new map<id,Deals__c>([Select id,name from Deals__c]);
     map<id,DealProduct__c> dealprod = new map<id,DealProduct__c>();
     map<Id,Products__c> product = new map<Id,Products__c>([select Id,NHSListPrice__c from Products__c where name =:  dplist.list__r.name]);
     if(trigger.isInsert)
      {                                
        for(DealProduct__c obj :Trigger.new)
        {
        if(product.size() > 0)
        {
       DealProduct__c dealprd = new DealProduct__c(
       NHSListPrice__c = product.get(obj.id).NHSListPrice__c);
       dplist.add(dealprd);
        }
        }
       }
}

Actually I am trying to insert 'NHSListPrice__c' field from 'Products__c' object to 'DealProduct__c' object. I cant insert. whether anything is wrong with the coding?
  • March 05, 2014
  • Like
  • 0
Class:


public class Cls_getSchemesPendingApproval{
  
     Public class wrapperClass{
       public Boolean checked{get; set;}
       public ID approvalProcessID{get; set;}
       public ID schemesRecordID{get; set;}
       public String payname{get; set;}
       public String schemedesc{get; set;}
       public String shortname {get; set;}
       public String period{get; set;}
       public String deal_id{get; set;}
       public String status{get; set;}
       public String DateStart {get; set;}
       public String schemetype{get; set;}
       public String DateEnd {get; set;}
    //   public boolean held{get; set;}
       //public ERS_schemess__c schemes{get; set;}
       public wrapperClass(){}   
   }
   public String stringCustomer {get;set;}
   Set<ID> paySet = new Set<ID>();
   Map<Id, Id> processMap = new Map<Id, Id>();
   public List<wrapperClass> wrapClassList{get; set;}
   public List<wrapperClass> wrapClassHeldList{get; set;}
   public List <ERS_schemes__c> payList {get;set;}
  
   public List<wrapperClass> wrapList{get; set;}
   //Number of records to be shown in each
  
  
   public Integer intPageSize {get; set;}
   //Total number of records in the search results list
   public Integer intRecordSize {get; set;}
   public ApexPages.StandardSetController con{ get; set;}
   //Total number of records in the search results list
   public integer intTotalRecords{get; set;}
  

  
   //returns the results list to be displayed on the screen
   public List<wrapperClass> testList{
    get{
        List<wrapperClass> lstWrap = new List<wrapperClass>();
      if(wrapList!=null && wrapList.size()>0){
        List<ERS_schemes__c> lstschemes = con.getRecords();
        For(ERS_schemes__c obj :  lstschemes){
            for(wrapperClass ow : wraplist){
                if(ow.schemesRecordID == obj.id){
                    lstWrap.add(ow);
                }
            }
        }
        return lstWrap;
      }else{
        return null;
      }
    }
    set;
  }
  
  
   public pageReference doAction(){
        wrapList = getschemes();     
        setResultsInController(wrapList);
        return null;
   }
  
     /*
  * This method sets the result list in the controller along with other properties like
  * page size. Used for pagination
  */
  private void setResultsInController(List<wrapperClass> wrapList){
    try{
      intPageSize = 1;
      Set<String> schemesRecordIds = new Set<string>();
      for(wrapperClass obj : wrapList){
        schemesRecordIds.add(obj.schemesRecordID);
      }
     
      con  =  new ApexPages.StandardSetController([Select id from ERS_schemes__c where id in :schemesRecordIds order by createdDate desc]);
      con.setPageSize(intPageSize);
      integer intResultSize = con.getResultSize();
      if(math.mod(intResultSize,intPageSize) == 0)
        intRecordSize = (con.getResultSize())/intPageSize;
      else
        intRecordSize = ((con.getResultSize())/intPageSize) +1;
      intTotalRecords=wrapList.size();
    }catch(Exception e){
     
    }
  }
  
  
   public List<wrapperClass> getschemes(){
   List<Approval.ProcessWorkitemRequest> PWRList  = new List<Approval.ProcessWorkitemRequest>();
   wrapClassList = new List <wrapperClass>();
   wrapClassHeldList = new List <wrapperClass>();
   // get the queues which the user belongs to
   List<GroupMember> queues = [SELECT GroupId FROM GroupMember where UserOrGroupId  = :userInfo.getUserID()];
   List<String> users = new List<String>();
   users.add(userInfo.getUserID());
   //add the queues to which the user belongs
   for( GroupMember grp : queues){
       users.add(grp.GroupId);
   }
  
  // List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
    //      FROM ProcessInstanceWorkitem where actorid = :userInfo.getUserID()];
   
    List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
          FROM ProcessInstanceWorkitem where actorid in :users];
         
  
   if(!piwiList.isempty()){  
         // create a set of the schemes ids
               
       for (ProcessInstanceWorkitem piwi : piwiList){
               if(String.valueof(piwi.ProcessInstance.targetobjectid.getSobjectType())== 'ERS_schemes__c'){
                   paySet.add(piwi.ProcessInstance.targetobjectid);
                   processMap.put(piwi.ProcessInstance.targetobjectid, piwi.id);
                   //system.debug('vikkk' + piwi.ProcessInstance.targetobjectid);
                   //system.debug('hiya' + piwi.id);
               }
       }
     
            payList = [select  id, EndDate__c,  SchemeShortName__c, StartDate__c, Status_desc__c, SchemeType__c from ERS_schemes__c where id in
                   :paySet];
    
      
       
        for(ERS_schemes__c pay : payList){
                wrapperClass wrapClass = new wrapperClass();
                wrapClass.checked = false;
                wrapClass.approvalProcessID = processMap.get(pay.id);
              
                wrapClass.schemesRecordID = pay.id;
                //wrapClass.schemedesc = pay.SchemeDescription__c;
                wrapClass.shortname = pay.SchemeShortName__c;
                wrapClass.status = pay.Status_desc__c;
                wrapClass.DateEnd = pay.EndDate__c.day() + '-' + pay.EndDate__c.month() + '-' + pay.EndDate__c.year();
                wrapClass.schemetype=  pay.SchemeType__c ;
                wrapClass.DateStart = pay.StartDate__c.day() + '-' + pay.StartDate__c.month() + '-' + pay.StartDate__c.year();
                wrapClassList.add(wrapClass);
          }   
         }

    
   return wrapClassList;        
   } 
  }



Test Class:

@isTest
private class Test_getSchemesPendingApproval
{
static testMethod void testTrigger()
{
Cls_getSchemesPendingApproval pdd= new Cls_getSchemesPendingApproval();
Cls_getSchemesPendingApproval.wrapperclass wrapperclass=new Cls_getSchemesPendingApproval.wrapperclass();
List<Cls_getSchemesPendingApproval.wrapperclass> wrapperclass1=new List<Cls_getSchemesPendingApproval.wrapperclass>();
wrapperclass1.add(wrapperclass);

List<ERS_Schemes__c> scheme = new List<ERS_Schemes__c>();

  ERS_Schemes__c scheme1 = new ERS_Schemes__c();
    scheme1.SchemeShortName__c='te';
    scheme1.SchemeDescription__c='test';
    scheme1.EndDate__c=Date.newInstance(2014,12,02);
    scheme1.StartDate__c=Date.newInstance(2014,12,01);
    //scheme.Status__c='ACT';
    insert scheme1;
    scheme.add(scheme1);

Test.StartTest();
pdd.paylist=scheme;
pdd.wrapClassHeldList=wrapperclass1;
pdd.wrapClassList=wrapperclass1;
pdd.testList=wrapperclass1;
pdd.doAction();
pdd.getschemes();
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(scheme);
pdd.con = sc;
Test.StopTest();
}
}


Getting only 66%. Can anyone help me covering 100%...Lines in BOLD are not covered.
  • March 03, 2014
  • Like
  • 1
After running the test class when i open the class file, the code coverage is 100%. But the total number of lines of the class is 954. its showing only 182.

User-added image

when i open Developer consiole and check the same class it is showing only 45%.

User-added image

Can anyone help me what is the issue with this.?
  • February 25, 2014
  • Like
  • 0
Class:

global class Cls_ApprovalRecall
{
    webservice static void recallApproval(Id recId)   
    {       
        ID piwiID = [SELECT Id, ProcessInstanceId, ProcessInstance.TargetObjectId FROM ProcessInstanceWorkitem WHERE ProcessInstance.TargetObjectId =: recId].ID;
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setAction('Removed');       
        req.setWorkitemId(piwiID );
  
        Approval.process(req,false);
    }
}


Test class:
@isTest
private class Test_ApprovalRecall
{
static testMethod void testClass()
{
Cls_ApprovalRecall app = new Cls_ApprovalRecall();

    Deals__c deal = new Deals__c();
    deal.Status__c='ACT';
    deal.DateEnd__c=Date.newInstance(2013,12,01);
    insert deal;  

id recId=deal.id;

Test.StartTest();
List<ProcessInstance> processInstances = [select Id, Status from ProcessInstance where TargetObjectId = :deal.id];
Cls_ApprovalRecall.recallApproval(recId);
Test.StopTest();

}
}


Error:

List has no rows assigned to sobject.
  • January 31, 2014
  • Like
  • 0
My Class:

public class Cls_FutureMethods{

    @future
    public static void processLargeAccounts(Id AllTierID,Decimal TUDMin){

        TUDTiers__c AllTierMin = [select Id,MinimumRange__c from TUDTiers__c where Id =: AllTierID];
      
        AllTierMin.MinimumRange__c=TUDMin+0.01;
        TUDTierUtility.isFutureUpdate = true;
        update AllTierMin;
    }
}

Test
@isTest
private class Test_FutureMethods
{
static testMethod void testTrigger()
{
Cls_FutureMethods fut= new Cls_FutureMethods();

TUDTiers__c tud = new TUDTiers__c();
tud.MinimumRange__c=45.67;
tud.Tier__c=25.36;
insert tud;


Decimal TUDMin=45.56;
TUDTierUtility.isFutureUpdate = true;

Test.StartTest();
Test.StopTest();
}
}

My Code coverage is 0. How can i increase the code coverage for this..Need help.
  • January 31, 2014
  • Like
  • 0
My Class:

public class getDealPendingApproval{
  
Public class wrapperClass{
       public Boolean checked{get; set;}
       public ID approvalProcessID{get; set;}
       public ID DealsRecordID{get; set;}
       public String payname{get; set;}
       public String customer_no{get; set;}
       public String customer_name{get; set;}
       public String period{get; set;}
       public String deal_id{get; set;}
       public String status{get; set;}
       public String DateStart {get; set;}
       public String VendorNumber {get; set;}
       public String DateEnd {get; set;}
       public String schemeType {get; set;}
       public wrapperClass(){} 
  
   }
   public String stringCustomer {get;set;}
   Set<ID> paySet = new Set<ID>();
   Map<Id, Id> processMap = new Map<Id, Id>();
   public List<wrapperClass> wrapClassList{get; set;}
   public List<wrapperClass> wrapClassHeldList{get; set;}
   public List <Deals__c> payList {get;set;}
  
   public List<wrapperClass> wrapList{get; set;}
   //Number of records to be shown in each
   public Integer intPageSize {get; set;}
   //Total number of records in the search results list
   public Integer intRecordSize {get; set;}
   public ApexPages.StandardSetController con{ get; set;}
   //Total number of records in the search results list
   public integer intTotalRecords{get; set;}
  
   //returns the results list to be displayed on the screen
   public List<wrapperClass> testList{
    get{
        List<wrapperClass> lstWrap = new List<wrapperClass>();
      if(wrapList!=null && wrapList.size()>0){
        List<Deals__c> lstDeals = con.getRecords();
        For(Deals__c obj :  lstDeals){
            for(wrapperClass ow : wraplist){
                if(ow.DealsRecordID == obj.id){
                    lstWrap.add(ow);
                }
            }
        }
        return lstWrap;
      }else{
        return null;
      }
    }
    set;
  }
  
  
   public pageReference doAction(){
        wrapList = getDeals(stringCustomer);     
        setResultsInController(wrapList);
        return null;
   }
  

  private void setResultsInController(List<wrapperClass> wrapList){
 
      intPageSize = 1;
      Set<String> DealsRecordIds = new Set<string>();
      for(wrapperClass obj : wrapList){
        DealsRecordIds.add(obj.DealsRecordID);
      }
     
      con  =  new ApexPages.StandardSetController([Select id from Deals__c where id in :DealsRecordIds order by createdDate desc]);
      con.setPageSize(intPageSize);
      integer intResultSize = con.getResultSize();
      if(math.mod(intResultSize,intPageSize) == 0)
        intRecordSize = (con.getResultSize())/intPageSize;
      else
        intRecordSize = ((con.getResultSize())/intPageSize) +1;
      intTotalRecords=wrapList.size();
   
  }
  
  
   public List<wrapperClass> getDeals(String strCustomer){
   List<Approval.ProcessWorkitemRequest> PWRList  = new List<Approval.ProcessWorkitemRequest>();
   wrapClassList = new List <wrapperClass>();
 
   // get the queues which the user belongs to
   List<GroupMember> queues = [SELECT GroupId FROM GroupMember where UserOrGroupId  = :userInfo.getUserID()];
   List<String> users = new List<String>();
   users.add(userInfo.getUserID());
   //add the queues to which the user belongs
   for( GroupMember grp : queues){
       users.add(grp.GroupId);
   }
  
  // List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
    //      FROM ProcessInstanceWorkitem where actorid = :userInfo.getUserID()];
   
    List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
          FROM ProcessInstanceWorkitem where actorid in :users];
         
  
   if(!piwiList.isempty()){  
         // create a set of the Deals ids
               
       for (ProcessInstanceWorkitem piwi : piwiList){
               if(String.valueof(piwi.ProcessInstance.targetobjectid.getSobjectType())== 'Deals__c'){
                   paySet.add(piwi.ProcessInstance.targetobjectid);
                   processMap.put(piwi.ProcessInstance.targetobjectid, piwi.id);
                  

               }
       }
      
            payList = [select id, Customer_Name__c, Customer_no__r.name, Customer_no__r.schemeType__c,  Deal_Id_Hidden__c, Deal_ID__c, DateEnd__c, VendorNumber__c, DateStart__c, Status_desc__c from Deals__c where id in
                   :paySet ];
      
       
        for(Deals__c pay : payList){
                wrapperClass wrapClass = new wrapperClass();
                wrapClass.checked = false;
                wrapClass.approvalProcessID = processMap.get(pay.id);
              
                wrapClass.DealsRecordID = pay.id;
                wrapClass.customer_no = pay.Customer_no__r.name;
                wrapClass.customer_name = pay.Customer_Name__c;
                //wrapClass.period = pay.period__c;
                wrapClass.deal_id =pay.Deal_Id_Hidden__c;
                wrapClass.status = pay.Status_desc__c;
                wrapclass.schemeType= pay.Customer_no__r.schemeType__c;
                wrapClass.DateEnd =  pay.DateEnd__c.day() + '-' + pay.DateEnd__c.month() + '-' + pay.DateEnd__c.year();
                wrapClass.VendorNumber =  pay.VendorNumber__c;
                wrapClass.DateStart = pay.DateStart__c.day() + '-' + pay.DateStart__c.month() + '-' + pay.DateStart__c.year();
                wrapClassList.add(wrapClass);

          }   
         }
    
   return wrapClassList;        
   } // end of getDeals
      
}


Test Class:


@isTest(seeAllData=true)
private class Test_getDealPendingApproval
{
static testMethod void testTrigger()
{
getDealPendingApproval pdd= new getDealPendingApproval();

Deals__c deal= new Deals__c();
insert deal;

Test.StartTest();
pdd.doAction();
pdd.getDeals('test');
Test.StopTest();
}
}

Need Help in Code coverage. Currently coverage is 55%.
  • January 29, 2014
  • Like
  • 0
My class:

global class ApprovalRecall
{
    webservice static void recallApproval(Id recId)   
    {       
        ID piwiID = [SELECT Id, ProcessInstanceId, ProcessInstance.TargetObjectId FROM ProcessInstanceWorkitem WHERE ProcessInstance.TargetObjectId =: recId].ID;
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setAction('Removed');       
        req.setWorkitemId(piwiID );
  
        Approval.process(req,false);
    }
}

Test class:

@isTest
private class ERS_Test_ApprovalRecall
{
static testMethod void testTrigger()
{
  Deals__c deal = new Deals__c();
  insert deal;
       
        // Reject the submitted request, providing a comment.
        Approval.ProcessWorkitemRequest testRej = new Approval.ProcessWorkitemRequest();
        testRej.setAction  ('Removed');
        testRej.setWorkitemId(deal.id);
   
        Test.startTest();       
            // Process the rejection
            Approval.ProcessResult testRejResult =  Approval.process(testRej);
        Test.stopTest();
       
        // Verify the rejection results
        System.assert(testRejResult.isSuccess(), 'Rejections that include comments should be permitted');
        System.assertEquals('Rejected', testRejResult.getInstanceStatus(),
          'Rejections that include comments should be successful and instance status should be Rejected');
  
}
}

Error:
System.DmlException: Process failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

Can anyone help me with this?
  • January 28, 2014
  • Like
  • 0
Valid: 12.00, 12.10, 12.01, 12.56
Not Valid: 12, 12.1, 12.0

NOT(REGEX(TEXT(Price__c), "[0-9]+[.][0-9][0-9]?"))

I am writing an validation rule for currency field. Can anyone help me with this.
  • January 16, 2014
  • Like
  • 0
Class:


public class Cls_getSchemesPendingApproval{
  
     Public class wrapperClass{
       public Boolean checked{get; set;}
       public ID approvalProcessID{get; set;}
       public ID schemesRecordID{get; set;}
       public String payname{get; set;}
       public String schemedesc{get; set;}
       public String shortname {get; set;}
       public String period{get; set;}
       public String deal_id{get; set;}
       public String status{get; set;}
       public String DateStart {get; set;}
       public String schemetype{get; set;}
       public String DateEnd {get; set;}
    //   public boolean held{get; set;}
       //public ERS_schemess__c schemes{get; set;}
       public wrapperClass(){}   
   }
   public String stringCustomer {get;set;}
   Set<ID> paySet = new Set<ID>();
   Map<Id, Id> processMap = new Map<Id, Id>();
   public List<wrapperClass> wrapClassList{get; set;}
   public List<wrapperClass> wrapClassHeldList{get; set;}
   public List <ERS_schemes__c> payList {get;set;}
  
   public List<wrapperClass> wrapList{get; set;}
   //Number of records to be shown in each
  
  
   public Integer intPageSize {get; set;}
   //Total number of records in the search results list
   public Integer intRecordSize {get; set;}
   public ApexPages.StandardSetController con{ get; set;}
   //Total number of records in the search results list
   public integer intTotalRecords{get; set;}
  

  
   //returns the results list to be displayed on the screen
   public List<wrapperClass> testList{
    get{
        List<wrapperClass> lstWrap = new List<wrapperClass>();
      if(wrapList!=null && wrapList.size()>0){
        List<ERS_schemes__c> lstschemes = con.getRecords();
        For(ERS_schemes__c obj :  lstschemes){
            for(wrapperClass ow : wraplist){
                if(ow.schemesRecordID == obj.id){
                    lstWrap.add(ow);
                }
            }
        }
        return lstWrap;
      }else{
        return null;
      }
    }
    set;
  }
  
  
   public pageReference doAction(){
        wrapList = getschemes();     
        setResultsInController(wrapList);
        return null;
   }
  
     /*
  * This method sets the result list in the controller along with other properties like
  * page size. Used for pagination
  */
  private void setResultsInController(List<wrapperClass> wrapList){
    try{
      intPageSize = 1;
      Set<String> schemesRecordIds = new Set<string>();
      for(wrapperClass obj : wrapList){
        schemesRecordIds.add(obj.schemesRecordID);
      }
     
      con  =  new ApexPages.StandardSetController([Select id from ERS_schemes__c where id in :schemesRecordIds order by createdDate desc]);
      con.setPageSize(intPageSize);
      integer intResultSize = con.getResultSize();
      if(math.mod(intResultSize,intPageSize) == 0)
        intRecordSize = (con.getResultSize())/intPageSize;
      else
        intRecordSize = ((con.getResultSize())/intPageSize) +1;
      intTotalRecords=wrapList.size();
    }catch(Exception e){
     
    }
  }
  
  
   public List<wrapperClass> getschemes(){
   List<Approval.ProcessWorkitemRequest> PWRList  = new List<Approval.ProcessWorkitemRequest>();
   wrapClassList = new List <wrapperClass>();
   wrapClassHeldList = new List <wrapperClass>();
   // get the queues which the user belongs to
   List<GroupMember> queues = [SELECT GroupId FROM GroupMember where UserOrGroupId  = :userInfo.getUserID()];
   List<String> users = new List<String>();
   users.add(userInfo.getUserID());
   //add the queues to which the user belongs
   for( GroupMember grp : queues){
       users.add(grp.GroupId);
   }
  
  // List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
    //      FROM ProcessInstanceWorkitem where actorid = :userInfo.getUserID()];
   
    List<ProcessInstanceWorkitem> piwiList = [SELECT ActorId,Id,IsDeleted,ProcessInstanceId, ProcessInstance.targetobjectid
          FROM ProcessInstanceWorkitem where actorid in :users];
         
  
   if(!piwiList.isempty()){  
         // create a set of the schemes ids
               
       for (ProcessInstanceWorkitem piwi : piwiList){
               if(String.valueof(piwi.ProcessInstance.targetobjectid.getSobjectType())== 'ERS_schemes__c'){
                   paySet.add(piwi.ProcessInstance.targetobjectid);
                   processMap.put(piwi.ProcessInstance.targetobjectid, piwi.id);
                   //system.debug('vikkk' + piwi.ProcessInstance.targetobjectid);
                   //system.debug('hiya' + piwi.id);
               }
       }
     
            payList = [select  id, EndDate__c,  SchemeShortName__c, StartDate__c, Status_desc__c, SchemeType__c from ERS_schemes__c where id in
                   :paySet];
    
      
       
        for(ERS_schemes__c pay : payList){
                wrapperClass wrapClass = new wrapperClass();
                wrapClass.checked = false;
                wrapClass.approvalProcessID = processMap.get(pay.id);
              
                wrapClass.schemesRecordID = pay.id;
                //wrapClass.schemedesc = pay.SchemeDescription__c;
                wrapClass.shortname = pay.SchemeShortName__c;
                wrapClass.status = pay.Status_desc__c;
                wrapClass.DateEnd = pay.EndDate__c.day() + '-' + pay.EndDate__c.month() + '-' + pay.EndDate__c.year();
                wrapClass.schemetype=  pay.SchemeType__c ;
                wrapClass.DateStart = pay.StartDate__c.day() + '-' + pay.StartDate__c.month() + '-' + pay.StartDate__c.year();
                wrapClassList.add(wrapClass);
          }   
         }

    
   return wrapClassList;        
   } 
  }



Test Class:

@isTest
private class Test_getSchemesPendingApproval
{
static testMethod void testTrigger()
{
Cls_getSchemesPendingApproval pdd= new Cls_getSchemesPendingApproval();
Cls_getSchemesPendingApproval.wrapperclass wrapperclass=new Cls_getSchemesPendingApproval.wrapperclass();
List<Cls_getSchemesPendingApproval.wrapperclass> wrapperclass1=new List<Cls_getSchemesPendingApproval.wrapperclass>();
wrapperclass1.add(wrapperclass);

List<ERS_Schemes__c> scheme = new List<ERS_Schemes__c>();

  ERS_Schemes__c scheme1 = new ERS_Schemes__c();
    scheme1.SchemeShortName__c='te';
    scheme1.SchemeDescription__c='test';
    scheme1.EndDate__c=Date.newInstance(2014,12,02);
    scheme1.StartDate__c=Date.newInstance(2014,12,01);
    //scheme.Status__c='ACT';
    insert scheme1;
    scheme.add(scheme1);

Test.StartTest();
pdd.paylist=scheme;
pdd.wrapClassHeldList=wrapperclass1;
pdd.wrapClassList=wrapperclass1;
pdd.testList=wrapperclass1;
pdd.doAction();
pdd.getschemes();
ApexPages.StandardSetController sc = new ApexPages.StandardSetController(scheme);
pdd.con = sc;
Test.StopTest();
}
}


Getting only 66%. Can anyone help me covering 100%...Lines in BOLD are not covered.
  • March 03, 2014
  • Like
  • 1
Hi,
I enabled my lightning experience in my developer sandbox. after that i tried to login to my account it is not allowing me to login. i was getting this error,

User-added image

Thanks
Vivek
  • December 09, 2015
  • Like
  • 0
I am getting this error "DML requires SObject or SObject list type: Set<Status__c>  " when i tried to save the class. This is my code.

Apex Class:
        List<Status__c> OpprtyToUpsert = new List<Status__c>(); 
        Set<Status__c> OpprtyToset = new Set<Status__c>(); 
        Status__c acc = new Status__c();
        for (OppWrapper avar : OppWrappersList )
        {
            if (avar.UpdatePrev == True)
                {
                   if (avar.acc.id != null)               
                       {                
                           avar.acc.Satisfied_By_Previous_Deal__c = true;
                           OpprtyToUpsert.add(avar.acc); 
                           OpprtyToset.addAll(OpprtyToUpsert); 
                       }
                }
             else if (avar.UpdateSta == True)
                {
                    if (avar.acc.id != null)               
                        {
                            avar.acc.Current_Status__c = selectestatus;
                            OpprtyToUpsert.add(avar.acc);
                            OpprtyToset.addAll(OpprtyToUpsert); 
                        }
                }
        }
    upsert OpprtyToset;

I am getting duplicate id error when i tried to update the records so i converted List to Set and tried to update. But i cant save the class it is showing the above error. Can anyone help me? Thanks in advance.
  • July 12, 2015
  • Like
  • 0
I need to show some more fields while mousehover in my VF page. Here is my code

VF:
<td><div class="progress" style="width: {!progress}%;">
                                <a id="{!opp.Id}" href="{progress}" 
                                onmouseover="LookupHoverDetail.getHover('{!opp.id}', '/{!opp.Id}/m?retURL={!opp.Id}&isAjaxRequest=1').show();" 
                                onmouseout="LookupHoverDetail.getHover('{!opp.Id}').hide();"
                                onfocus="LookupHoverDetail.getHover('{!opp.Id}', '/{!opp.Id}/m?retURL={!opp.Id}&isAjaxRequest=1').show();"
                                onblur="LookupHoverDetail.getHover('{!opp.Id}').hide();">{!progress}%
                                </a>
</div></td>
Currently Opportunity field is only visible when i hover the mouse. I need to show other fields like Stage,Name, etc
  • July 12, 2015
  • Like
  • 0
I need to fetch records based on multiple pickl;ist value i have selected. 
This is my VF page.


       <apex:pageBlock> 
            <apex:pageBlockSection >
                <apex:outputLabel> Account Filter: &nbsp;
                    <apex:selectList value="{!selectedList}" size="5" id="AccountFilter" multiselect="true">
                        <apex:selectOptions value="{!selectList1}"/>
                        <apex:actionSupport action="{!loadDetails}" event="onclick" reRender="AccDMLTable"/>    
                    </apex:selectList>
                </apex:outputLabel> 
            </apex:pageBlockSection>              
            <apex:pageBlockSection > 
                <apex:outputLabel > Status Filter: &nbsp;
                    <apex:selectList value="{!selectedstList}" id="StatusFilter" size="5" multiselect="true">
                        <apex:selectOptions value="{!selectList2}"/>
                        <apex:actionSupport action="{!loadDetails}" event="onclick" reRender="AccDMLTable"/>
                    </apex:selectList> 
                </apex:outputLabel>    
            </apex:pageBlockSection>
      </apex:pageBlock>
    <apex:pageBlock>
        <table class="display" border= "1" id="AccDMLTable">
         <apex:repeat value="{!OppList}" var="a" id="AccDMLTable">
         <tr>
          <td>{!a.acc.Name}</td>
            <td>{!a.acc.Status}</td>
            <<td>{!a.acc.LastModifiedDate}</td>
         </tr>
         </apex:repeat>
         </table>
        <apex:commandButton value="Save" action="{!SaveAcc}" reRender="AccDMLTable"/>     
    </apex:pageBlock>
  • July 08, 2015
  • Like
  • 0
I have 2 picklist values in a custom VF page. Finance__c and Type__c. If i select a value in Finance the Type__c picklist should become mandatory field. If i select the other value in Finance the Type__c picklist value should not be mandatory field. How can we achieve this using VF page.? Can anyone help me with this?

User-added image
User-added image
  • March 13, 2015
  • Like
  • 0
Hi,

I have an Custom object 'Price__c' and an standard object 'Contact'. When an custom  object 'Price__c' is created, 'Contact' object is also created. My question is when we delete the 'Contact' record the corresponding 'Price__c' object record must also be get deleted. Both are not related to each other but they have 'Account' object as lookup fields in both object.

I am new to coding part can someone help me.

Code:
trigger DeleteContact on Contact (before delete) {
if(Trigger.isDelete) {
for(Contact c: Trigger.old) {
Account acc = [select id from Account];
Price__c mpe =  [Select Id,Name,Account__r.Name From Price__c where id =: acc.id];
Contact con = [Select Id,Name,Contact.Account.Name From Contact where id =: acc.id];
delete con;
}
}
  • May 09, 2014
  • Like
  • 0
Valid: 12.00, 12.10, 12.01, 12.56
Not Valid: 12, 12.1, 12.0

NOT(REGEX(TEXT(Price__c), "[0-9]+[.][0-9][0-9]?"))

I am writing an validation rule for currency field. Can anyone help me with this.
  • January 16, 2014
  • Like
  • 0