• RollNo1
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 9
    Replies

Can anyone help me with DesacribeLayout Call to get the prperties of a particular layout?

 

I need to know what are the fields that are set 'required' in pagelayout( by editing in the pagelayout) level. 

 

Hi,

    I need to retrieve a list of fields that are set 'Required' in pagelayout and not while creating that field.
How can i accomplish it through apex code?

Behaviour of a required field is to fill the field before any action(save/cancel). But I need an output field to just have the required mark but not the behaviour.

That I should be able to have that red mark and be able to save and cancel without any input in that field.

Please Help me out.

public with sharing class ddDashboard {

 public class phonesterDat{

  String type;
  Integer total;
  Integer valid;

  public String getType() {
   return type;
  }

  public void setType(String type){
   this.type= type;
  }

  public Integer getTotal() {
   return total;
  }
  public void setTotal(Integer total){
   this.total= total;
  }

  public Integer getValid() {
   return valid;
  }
  public void setValid(Integer valid){
   this.valid= valid;
  }

}
 public List<phonesterDat> getEmailData() {
 List<phonesterDat> var1 = new List<phonesterDat>();
 phonesterDat var = new phonesterDat();
 var.setType('Contact Email');
 var.setTotal([select count() from Contact where Email != null]);
 var.setValid([select count() from Contact where Email_Valid__c = true]);
 var1.add(var);
 return var1;
}


public List<phonesterDat> getCompanyData() {
List<phonesterDat> var1 = new List<phonesterDat>();
List<Account> accounts = [select DD_Segment__c from Account];
List<Keyword__c> keywords = [select kw__c from Keyword__c limit 50000];
for (Keyword__c keyword : keywords) {
 phonesterDat var = new phonesterDat();
 String str = keyword.kw__c;
 var.setType(str);
 Integer cnt = 0;
 for (Account acc : accounts) {
  if (acc.DD_Segment__c != null && acc.DD_Segment__c.contains(str)) {
    cnt = cnt+1;
 }
}
var.setTotal(cnt);
var1.add(var);
}
return var1;
}

}

 How to write test coverage for above code?

Hi,

 

New to enterprise edition. =)

 

I need a workflow formula that will trigger an email based on the following criteria:

 

A lead that has been contacted with no activity for 14 days the workflow action will trigger an email. 

 

According to the salesforce support, I need a custom workflow formula to set this up. Can anyone help me out. 

 

Thanks,

Gary

 

 

  • November 14, 2012
  • Like
  • 0

I'd like to display a value calculated from custom fields in a visualforce page without resorting to writing a custom controller. I tried writing a javascript function with no luck. Any help would be greatly appreciated.

 

below is my code for the page. when I try to save i get the error, "Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice."

 

<apex:page standardController="Property__c">
<script type="text/javascript"> 
function totalCost() {
    var price = {!Property__c.PurchPrice__c};
    var rehab = {!Property__c.TotalRehab__c};
    var totCost = price + rehab;
    return totCost;
    }
</script>
  <apex:outputText value="Purchase: "/><apex:outputText value="{0, number, $###,###}"><apex:param value="{!Property__c.PurchPrice__c}" /></apex:outputText><br/>
  <apex:outputText value="Rehab: "/><apex:outputText value="{0, number, $###,###}"><apex:param value="{!Property__c.TotalRehab__c}" /></apex:outputText><br/>
  <apex:outputText value="Total: "/><apex:outputText value="{0, number, $###,###}"><apex:param value="totalCost()" /></apex:outputText><br/>
</apex:page>

 

hi

 

i write test class i get only 52%

i have to get 80% code can u any one help me

 

thanks....

 

@isTest
public class Test_MemberPortal
{
 

 static testMethod void TestCls_ContactAuthentication()
 {

 
 Account testAccount=new Account();
 
 testAccount.Name='rvai';
 
 insert testAccount;
 
        Contact testContact=new Contact();
    testContact.lastname='devesh';
      testContact.firstName = 'James';
    testContact.username__c='test contact1';
    testContact.password__c = 'Password123';
    testContact.accountid=testAccount.id;
     insert testContact;
     

 
 
 
   Cls_ContactAuthentication objCls_ContactAuthentication  = new Cls_ContactAuthentication();
        objCls_ContactAuthentication.Username = 'User123';
        objCls_ContactAuthentication.password = 'Password123';
        objCls_ContactAuthentication.Login();
        objCls_ContactAuthentication.Username = 'User123NoMatch';
        objCls_ContactAuthentication.Login();
 

    }
    }

 

 

 

this is my apex class

 

 

//Class for User(Contact) Authentication
public class Cls_ContactAuthentication {
    public String Username{get; set;}
    public String password{get; set;}
    public ID ContactID;
    public ID UserID;
    public Boolean LoginFlag{get; set;}
    public List<Contact> contacts;
    public Session__c session;
    
    public CLS_ContactAuthentication (){
        
    }
    
    public PageReference Login(){
       
        contacts= new List<Contact>();
        session = new Session__c();
        try{
            contacts= [Select
                        id,username__c,password__c
                        from
                        Contact
                        where
                        username__c=:Username
                        AND
                        password__c=:password
                        
                      ];
                      
         
          System.debug('#####'+contacts);      
        }Catch(Exception e){
            System.debug(e);
        }
        if(contacts.size() > 0){
            for(Contact a : contacts){
               UserID = a.ID;
               session.Name = a.id;
            }
                upsert session;
                LoginFlag = false;
               if(Username=='' || Password=='')
               {
             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.FATAL, 'Username or Password is missing.......');
             ApexPages.addmessage(myMsg);
             return new PageReference('/apex/VF_ContactAuthentication');
             }
            
               else
               {
                PageReference page = new PageReference('/apex/VF_ContactHomePage');
                page.getParameters().put('ID',UserID);
                page.setRedirect(true);
                return page;
                }
        }else{
                LoginFlag = true;
                return null;
        }
    }
}

hi friends,

            how to write trigger for phone number validation

hi

 

am very new to test class plz help for the apex class for test class

 //Class for User(Contact) Authentication
public class Cls_ContactAuthentication {
    public String Username{get; set;}
    public String password{get; set;}
    public ID ContactID;
    public ID UserID;
    public Boolean LoginFlag{get; set;}
    public List<Contact> contacts;
    public Session__c session;
    
    public CLS_ContactAuthentication (){
        
    }
    
    public PageReference Login(){
       
        contacts= new List<Contact>();
        session = new Session__c();
        try{
            contacts= [Select
                        id,username__c,password__c
                        from
                        Contact
                        where
                        username__c=:Username
                        AND
                        password__c=:password
                        
                      ];
                      
         
          System.debug('#####'+contacts);      
        }Catch(Exception e){
            System.debug(e);
        }
        if(contacts.size() > 0){
            for(Contact a : contacts){
               UserID = a.ID;
               session.Name = a.id;
            }
                upsert session;
                LoginFlag = false;
               if(Username=='' || Password=='')
               {
             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.FATAL, 'Username or Password is missing.......');
             ApexPages.addmessage(myMsg);
             return new PageReference('/apex/VF_ContactAuthentication');
             }
            
               else
               {
                PageReference page = new PageReference('/apex/VF_ContactHomePage');
                page.getParameters().put('ID',UserID);
                page.setRedirect(true);
                return page;
                }
        }else{
                LoginFlag = true;
                return null;
        }
    }
}

 

thanks to all

Hi All,

            It would be helpful if you could let me know on how to import salesforce custom object data into excel sheet (without using any excel connector/ApexDataLaoder) programatically (Visual Force).

 

Thanks in advance..

 

Pavan..

Behaviour of a required field is to fill the field before any action(save/cancel). But I need an output field to just have the required mark but not the behaviour.

That I should be able to have that red mark and be able to save and cancel without any input in that field.

Please Help me out.