• Devendra@SFDC
  • SMARTIE
  • 1820 Points
  • Member since 2011

  • Chatter
    Feed
  • 61
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 110
    Questions
  • 617
    Replies
displaying all the objects in one block.
if we click on any object it should show that perticular object filed..
like that it shoud go on...
...like a formula table structure

Here is my code .....i didnot pass id value from pageblocktable column (param tag) to apex class ... it gives null....value...so please help me...

 

 

<apex:page controller="approvalclass" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageblockTable value="{!data}" var="d">
<apex:column >
<apex:outputPanel >
<apex:commandButton action="{!approvalagent}" value="Approv">
<apex:param value="{!d.id}" name="{!passid}" assignTo="{!passid}"/>
</apex:commandButton>
<apex:commandButton action="{!rejectagent}" value="Regect">
<apex:param value="{!d.id}" assignTo="{!passid}" name="passid"/>
</apex:commandButton>
</apex:outputPanel>
</apex:column>
<apex:column value="{!d.Account__c}"/>
<apex:column value="{!d.State_Territory__c}"/>
<apex:column value="{!d.Policy_Types__c}"/>
<apex:column value="{!d.Policie_status__c}"/>
<apex:column value="{!d.State_Territory__c}"/>
<apex:column value="{!d.Commission_Rate__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

-------------------------

class

 

 

public with sharing class approvalclass {
public string passid { get; set; }
public list<policie__c> p=new list<policie__c>();
list<policie__c> pc=new list<policie__c>();
public approvalclass(){
passid= System.currentPageReference().getParameters().get('id');
system.debug('*********************************************'+passid);  }
    public PageReference rejectagent() {
    system.debug('*********************************************'+passid);
       pc=[select id,name,Maturity_Amount__c,Commission_Rate__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,State_Territory__c from policie__c];
   for(policie__c pt:pc )
   {
     if(pt.Commission_Rate__c!=null && pt.id==passid)
     pt.Approval_status__c='Reject';
     
          upsert pt;  
    }  
      return null;
    }


    public PageReference approvalagent() {
       system.debug('*********************************************'+passid);
   pc=[select id,name,Maturity_Amount__c,Commission_Rate__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,State_Territory__c from policie__c];
   for(policie__c pts:pc)
   {
      if(pts.Commission_Rate__c!=null && pts.id==passid)
       pts.Approval_status__c='approval';
    
      upsert pts;   
    }
    
        pagereference ref = new pagereference('https://ap1.salesforce.com'+passid);
        ref.setredirect(true);
        return ref;

 
 }

    public list<policie__c>getData() {
    p=[select id,name,Maturity_Amount__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,Commission_Rate__c,State_Territory__c from policie__c where ownerid=:userinfo.getuserid()];
    
        return p;
    }



}

Hi

 

I am trying to create my own custom home page. Is there a quick and easy way I can place the standard Salesforce Home Page components on this VF page (before I add my own stuff). In particular I need Calendar ,Tasks and Messages and Alerts.

 

 

Many thanks for any and all help,.

Ross

 

Recruiting App is bast for Admin (Configuration)  , But Whitch is best App for Developer like Apex, Triggers, VF pages 

If u know any one ple  refer me as pdf or any link 

                                     

                                                                                           Thank u.

What should be the code coverage for a Trigger? 

Hi All

 

I have 2 lakhs records, out of 2 lakhs i want to display 1 lakh records only? what is the query ?

 

thanksin adavance

 

pavan

hi 

i am new to salesforce could anyone please help.

i have a problem

i have 3 pages using the same controller

page1

page2

page3

controller1

 

i am calling page2 using

 PageReference page2 = new PageReference('/apex/page2');
  page2.setRedirect(false);
  return page2;

 

i m calling page3 using:

 PageReference newpage = new PageReference('/apex/page3');
  newpage.setRedirect(true);
  return newpage;

 

does setredirect(false) call the page 2 times?

i mean first time when i call the page2, as set redirect is false its url is still showing page1

but next time when i try to call page3 when im on url of page1 but internally from server im on page2

page3 is not displayed n it calls page2 again.

Could you please help or provide an example of calling next pages with setRedirect(false);

with the urls.

 

Thanks.

Hi,

         I am new to salesforce i am trying to understand visualforce page and apex .I have wriiten piece of code  in visual force without the controller as suggested by the developer book for salesforce but which is giving me error when i tried to save saying it is java.lang.IllegalArgumentException: Illegal view ID !{save}. The ID must begin with /

 

<apex:form >
<apex:pageBlock title="Edit Account for {!$User.FirstName}">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="!{save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!account.Start_Date__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
</apex:pageBlock>
</apex:form>
</apex:page>

 

Can someone tell me what am i making mistake in this code.I really appreciate your help.

So let me preface this by stating that I have searched the boards and Google in general and have not been able to find a simplified explanation for what I am trying to do. I have very limited coding skills and no experience when it comes to Apex triggers so I appreciate in advance any and all help you can provide. I will do my best to explain below what I am trying to do.

 

On my lead records, I have a look up field to a custom object called 'Distributors.' If a lead comes in from an outside distributor, then the internal sales rep can look up and add the appropriate distributor. Sometimes these outside distributors have co-branded web landing pages so that visitors can fill out a web form, which becomes a new lead record. What I need is a way to have the distributor automatically filled in, something that doesn't necessarily need to occur upon the initial record creation, but could happen following this initial creation or during the subsequent record editing.

 

What I have in mind is a hidden pick list with all distributors listed. The web form would be set to default to the specified distributor value and the apex trigger would then take the text of this value and insert it into the look up field. If this doesn't work because of the source being a pick list, then I could create a workflow that takes the pick list value and inserts it into a text box. 

 

What I need help with is the basic code to make this happen as it's something that I will need to perhaps extend to campaigns and other custom objects that rely on the use of a look up fields on the lead record.

 

Once again, thank you in advance for taking the time to read this and for any help that can be provided.

Hi,

 

I am migrating data from one salesforce org to another. Can any one tell me how do I migrate Attachments?

I used the file exporter to download the attachments from the source org but while uploading attachments to the new org

I got the error "Error Converting value to correct data type"

 

Any help would be highly appreciated.

 

Hi, I am trying to create a managed package in a Dev Org but the problem is as soon as I create the managed package and compile all the classes in the org, i get the below error. Surprisingly when I comment these lines also, i get the same error . Looks like it is being picked from cache.

line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote

This field set is part of the managed package. So not sure what is the issue here ? I see this issue everywhere where field sets are used. We need to create the managed package and deliver it to the testing team ASAP so that it can be delivered to the client. Any help would be highly appreciated. Below are the Org details.

Org Id : 00Db0000000XxKP
Instance : eu2

Important Note : I have tried deploying all the code in 3 different Dev orgs and everywhere I got the same error.\

 

 

-Vik

 I have a inputtext  in my VF page  as

 

        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
          </apex:panelGroup>
         </apex:pageblockSectionItem>
        </apex:pageBlockSection>

 

I'm using that text field in my controller to compare one of my text field in the LeadBackup__c object as

 

public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText,
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id,
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email,
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where                 Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c,
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c,
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
 
 
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){  -----------------From Here my code is not covering how to pass this search text in test class
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear();
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
 
  return null;
 
}

 

How to pass this search text to the test class ......

Any help would appreciated greatly...

 

 

I've written this super easy trigger which only sets a date. I'm still learning how to write test code, so I was wondering if anybody could show me what it would be like for something this simple :

 

trigger SetContractEndDates on Contract_Terms__c (before insert, before update) {

  for (Contract_Terms__c ct : Trigger.new) {
          if (ct.Auto_Renewal_Contract_End_Date__c== null)
          ct.Overall_End_Date__c= ct.Contract_End_Date__c;
        else
          ct.Overall_End_Date__c = ct.Auto_Renewal_Contract_End_Date__c;  
  }
}

 

Thank you very much.

Dear All,

 

We had created a custom check box in the user object, as per the check box value ( checked/ Un checked),   

i would like to restrict the user to not to enter values in the pick list fields.

 

If the pick list value is checked then user can enter values to the pick list fields. If it is unchecked, then i should restrict him.

 

Any one can help me in this scenario.

 

Promt responses will highly appriciated.

 

Thank you

 

Regards,

Prakki 

I created a Custom Object application on my regular Salesforce account.  I then created a Customer portal and enabled the tab and the custom object on the Portal site. 

 

It seems to be working, the portal user can view and access the tab and the object.. However, after the portal user enters the data and the record is created it is only saved on their portal account.    That data is not available to other portal users and is not transferring back to my Salesforce account?

 

I can't seem to find any information on this issue, so any suggestions would be appreciated.

 

Thanks

Scott

 

I have an apex component in which the constructor in the controller is exectuting twice. I have made all the pages and classes as simple as possible to reproduce and this is what we have:

 

The Page

<apex:page >	
    <c:myComponent />
</apex:page>

 

The Component

<apex:component controller="MyController" >
    <apex:form >
        <apex:actionFunction name="thisIsMyName" action="{!doSomething}"  />	
    </apex:form>
</apex:component>

 

The Controller

public class MyController {
	
    //Constructor
    public MyController(){
        system.debug('I am a constructor and I am executing multiple times to drive you crazy.');
    }
    
    public void doSomething(){
    	//Blah blah blah
    }

}

 

The Debug Log

23.0 APEX_CODE,DEBUG
18:56:46.028 (28871000)|EXECUTION_STARTED
18:56:46.028 (28903000)|CODE_UNIT_STARTED|[EXTERNAL]|066500000008tEE|VF: /apex/mypage
18:56:46.039 (39198000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.039 (39850000)|METHOD_ENTRY|[1]|01p50000000DYoB|MyController.MyController()
18:56:46.039 (39939000)|METHOD_EXIT|[1]|MyController
18:56:46.041 (41245000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41308000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.041 (41830000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.041 (41872000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41894000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.071 (71248000)|CODE_UNIT_FINISHED|VF: /apex/mypage
18:56:46.071 (71263000)|EXECUTION_FINISHED

Any ideas why this is happening. It is making me go a little crazy.

 

If I move everything that is in the component directly to the page it will only execute once, as expected, but I need use components.

 

Thanks,

Jason