• Prallavi Dua
  • NEWBIE
  • 25 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 6
    Replies
Hi,
I have a below requirenment
 
  1. Render VF page as PDF
  2. Create a custom button on opportunity object which will redirect user to a VF page which will populate some opportunity fields and a table showing related opportunity product details in PDF form.
  3. Opportunity fields to populate
    • Opportunity Name
    • Parent Account Name
  4. There will be another section on this page which will populate the details of all the products related to opportunity.
  5. Show product details in a table populating following opportunity product fields
  6. This VF page should open in PDF format.
 
Can anyone help me!!!!!!!!!!!!!!
Thanks in Advance

 
Hi,

I have a VF page with picklist containing the all classes in the org. When I select the class its displays a body in another section.
In the same way it should display the ClassMethods on class selection.
Can Someone help me.

<apex:page controller="DynamicApexClasses_Controller">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection columns="2">
                <apex:pageblockSectionItem >
                    <apex:outputLabel value="Select a Class"/>
                </apex:pageblockSectionItem>       
                <apex:pageblockSectionItem >               
                    <apex:selectList size="1" value="{!state}">
                        <apex:selectOptions value="{!states}"/>
                        <apex:actionSupport event="onchange" reRender="a,aa" action="{!action1}"/>
                    </apex:selectList>               
                </apex:pageblockSectionItem>
                
                <apex:outputText value="{!t.Body}" id="a"/><br /><br />
                <apex:outputText value="{!s}" id="aa" escape="false"/>
            </apex:pageBlockSection>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>
==============================================================
public class DynamicApexClasses_Controller {
    public String state {get;set;}
    public String city {get;set;}
    public apexclass t{get;set;}
    public String s{get;set;}
    
    public List<SelectOption> getStates()
    {
        list<apexclass> aa = [select id,name from apexclass];
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('None','--- None ---'));
        for(apexclass a : aa){
            options.add(new SelectOption(a.id,a.name));
        }
        
        return options;
    }
    
    public void action1(){
        
        if(state!=null){
            t = [select id,name,Body from apexclass where id = :state];                
            s ='@isTest \n\n'+ '<br/>'+'Public Class ' + t.name+'Test{<br/>'+
                'Public void Postivetest(){<br/>'+'}<br/>'+'}' ;  
            
            String soql = 'SELECT ContentEntityId, SymbolTable FROM ApexClassMember where ContentEntityId = ' + t.id + '';
            system.debug('soql==' + soql);
        }
    }
}

Thanks in Advance
Hi,
I am using SOQL query to retrive all the class methods,
SOQL query ========= "select id,name,Body from apexclass''

Can someone help me to retrive all the class methods and variables using SOQL
Thanks
 
Hi,
Belew is the VF page and controller using the metadata methods.And there are two errors:
-->Method does not exist or incorrect signature: void createService() from the type MetadataController
--->Variable does not exist: customField

<apex:page controller="MetadataController">
    <apex:form id="form">
        <apex:sectionHeader title="Metadata Demo">
            <apex:pageMessages/>
                <apex:actionPoller action="{!checkStatus}" interval="5" rerender="form" rendered="{!NOT(ISNULL(Result))}">
                    <apex:outputPanel rendered="{!ISNULL(Result)}">
                        <apex:commandButton value="Create Field" action="{!createField}"/>
                        <!--apex:commandButton value="Delete Field" action="{!deleteField}"/-->
                    </apex:outputPanel>
                </apex:actionPoller>
        </apex:sectionHeader>
    </apex:form>
</apex:page>
--------------------------------------------------------------
public with sharing class MetadataController {
    
    public MetadataService.AsyncResult result {get;set;}
    public Book__c b{get;set;}
    
    public MetadataController(){
    
        result = new MetadataService.AsyncResult();        
    }
    
    
    public PageReference createField()
    {
        // .. as per above ...
        result = createService().create(new List<MetadataService.Metadata>{customField})[0];
        displayStatus();
        return null;
    }
    
    public PageReference checkStatus()
    {
        // Check status of the request
        //result = createService().checkStatus(new List<String> { result.Id })[0];
        displayStatus();
        return null;
    }
    
    private void displayStatus()
    {
        // Inspect the AsyncResult and display the result
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,
                                                   result.done ? 'Request completed' : 'Request in progress...'));
        if(result.state == 'Error')
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, result.message));
        if(result.done)
            result = null;
    }
}
Can someone help me

Thanks in Advance
Hi,
In the below link, I found a apex Class the same I copied in my dev org it's showing an error 'Compile Error: Defining type for testMethod methods must be declared as IsTest'
https://developer.salesforce.com/page/An_Introduction_to_Packaging

My dout is do we need to create a separate test class for manage PaCKAGE OR it should be included in the same class.
Thanks.
Hi,
Can anyone explain me the start process (i.e schema) of developing an Manage Package Application.

Thanks in Advance
Hi,
Can anyone please help me with this issue,'Test Generator' is a manage Package app in AppExchange, how can I know a code for it.
Thanks in Advance
Hi,
Below Code is the VF page and Controller for MultiSelect Picklist and also the test Class, But the code Coverage is 89%.
Can anyone please help me for 100% code coverage.
<apex:page controller="MultiSelectController">
    <style>
        .box{
            width :100px;
            length : 100px;
        
        }
    </style>
    <apex:form >
        <apex:panelGrid id="one" columns="3">
            <apex:selectList multiselect="true" styleClass="checkbox" value="{!added}">
                <apex:selectOptions value="{!selected}"></apex:selectOptions>
            </apex:selectList>
            <apex:panelGrid columns="1">
                <apex:commandButton action="{!addcities}" value="ADD" reRender="one"/>
                <apex:commandButton action="{!delcities}" value="DEL" reRender="one"/>
            </apex:panelGrid>
            <apex:selectList multiselect="true" styleClass="check" value="{!deleted}">
                <apex:selectOptions value="{!unSelected}"></apex:selectOptions>
            </apex:selectList>
        </apex:panelGrid>
            
    </apex:form>
</apex:page>
-----------------------------------------------------
public class MultiSelectController {
    public List<String> added{get;set;}
    public List<String> deleted{get;set;}
    public List<SelectOption> selected{get;set;}
    public List<SelectOption> unSelected{get;set;}
    public Set<String> sel{get;set;}
    public set<String> unsel{get;set;}
    
    public MultiSelectController(){
    added = new List<string>();
    deleted = new List<String>();
        sel = new Set<string>();
    unsel= new Set<String>();
    selected = new List<SelectOption>();
    unSelected = new List<selectOption>();
        List<String> cities = new List<String>{'HYD','Bang','Delhi','Pune','Mumbai'};
            unsel.addAll(cities);
        getData();
    }
    public void getData(){
        selected.clear();
        unSelected.clear();
        SelectOption op1 = new SelectOption('none','-None-');
        if(unsel.size()>0){
            for(String s1 : unsel){
                SelectOption op = new SelectOption(s1,s1);
               selected.add(op);
            }
           
        }
         else{
              Selected.add(op1);  
            }
            
        if(sel.size()>0){
            for(String s2:sel){
            selectOption op2 = new Selectoption(s2,s2);
                unSelected.add(op2);
                }
        }
        else{
            unselected.add(op1);
        }
    }
    public void addcities(){
    unsel.removeAll(added);
      sel.addAll(added);
      added.clear();
        getData();  
    }
    public void delcities(){
      sel.removeAll(deleted);
     unsel.addAll(deleted);
        getData();     
    }
}
----------------------------------------
@isTest
public class MiltiSelectTest {
      public static testMethod void TestController(){
      PageReference pagref = Page.MiltiSelect;
        Test.setCurrentPageReference(pagref);
          test.startTest();
          MultiSelectController MSP = new MultiSelectController();
          //MSP.addcities()
          MSP.addcities();
          MSP.delcities();
          MSP.getData();
          //MSP.unsel;
      test.stopTest();
      }

}
Hi,
Below is my Code: I am getting the error:method does not exist or incorrect signature: void clear() from the type string
Can anyone please help me.

<apex:page controller="Picklist_Controller">
    <apex:form>
        <apex:pageBlock>
          <apex:commandButton value="Show" action="{!Show}"/>
            <apex:pageBlockSection title="Countries">
                <apex:outputLabel>Country:</apex:outputLabel>
            <apex:selectList size="1" value="{!Countries}">
                <apex:selectOptions value="{!selectCountries}"/>
            </apex:selectList>
                </apex:pageBlockSection>
          <!--  <apex:selectList value="{!genders}" size="1">
                <apex:selectRadio value="{!Selectgender}"></apex:selectRadio>
            </apex:selectList>-->
            <apex:pageBlockSection title="Hobbies">
                  <apex:outputLabel>Hobby:</apex:outputLabel>
            <apex:selectList value="{!Hobby}" size="1">
                  <apex:selectOption itemLabel="--None--" itemvalue="None"></apex:selectOption>
                <apex:selectOption itemLabel="Swimming" itemvalue="Swimming"></apex:selectOption>
                <apex:selectOption itemLabel="Reading" itemvalue="Reading"></apex:selectOption>
                <apex:selectOption itemLabel="Cricket" itemvalue="Cricket"></apex:selectOption>
            </apex:selectList>
                </apex:pageBlockSection>
        </apex:pageBlock>
            <apex:pageBlock>
                <apex:pageBlockSection>
                    <apex:commandButton action="{!Erase}" value="Clear"/>
                </apex:pageBlockSection>
                <apex:outputText value="{!SelectedValues}" style="Color:Red"></apex:outputText>
            </apex:pageBlock>
    </apex:form>
</apex:page>
----------------------------------------------------------------------
public class Picklist_Controller {
    public List<SelectOption> selectCountries{get;set;}
  //  public List<SelectOption> selectGender{get;set;}
    public List<SelectOption> selecthobbies{get;set;}
    
    public String Countries{get;set;}
 //   public String genders{get;set;}
    public String Hobby{get;set;}
    public String selectedValues{get;set;}
    
    public Picklist_Controller(){
        selectCountries = new List<SelectOption>();
       // selectGender = new List<SelectOption>();
        selectHobbies = new List<SelectOption>();
       // selectedValues = new String();
     
        selectCountries.add(new SelectOption('---None--', 'None'));
        selectCountries.add(new SelectOption('India','India'));
        selectCountries.add(new SelectOption('USA','USA'));
        selectCountries.add(new SelectOption('UK','UK'));
        
      /*  selectGender.add(new SelectOption('Male','Male'));
        selectGender.add(new SelectOption('Female','Female'));*/
        
     /*   selectHobbies.add(new SelectOption('Reading','Reading'));
         selectHobbies.add(new SelectOption('Swimming','Swimming'));
         selectHobbies.add(new SelectOption('Dancing','Dancing'));
         selectHobbies.add(new SelectOption('Traveling','Traveling'));*/
    }
    
    public void Show(){
        selectedValues = 'Selected country:'+countries +'--------'+'Selected Hobby:'+Hobby;
 // return null;

    }
    public void Erase(){
          selectedValues.Clear();
  }
    
}
Hi,
Below is the link for web service,
Can anyone please help me how to intergate with VF page.

https://services.boatwizard.com/bridge/events/42b56bbe-d60d-46bd-b4db-3042b9b36428/boats

Thanks,
Prallavi
Hi,

Can anyone help me to write the VF page controller to, automatically create a record in one object when a new record is created in
another object.

Thanks,
Varalaxmi Jangay.
Hi,

In the below code, can any one explain the extension constructor, i.e.
 Contact newCon;
public exampleClass1(ApexPages.StandardController con) {
          this.newCon = (Contact)con.getRecord();
}
code:
public with sharing class exampleClass1 {
  Contact newCon;
  public exampleClass1(ApexPages.StandardController con) {
          this.newCon = (Contact)con.getRecord();
      }
    public pagereference save(){
      Account a = New Account(Name = newCon.FirstName + ' ' + newCon.LastName);
      Insert a;
      newCon.AccountID = a.id;
      insert newCon;

      Pagereference pr = New PageReference('/' + a.id);
      return pr;
   }
}

<apex:page standardController="Account" recordSetVar="count" >
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockTable value="{!count}" var="ac">
              <apex:column value="{!ac.Name}"/>
              <apex:column value="{!ac.Industry}"/>
          </apex:pageBlockTable>
              <apex:pageBlock >
                  <apex:commandButton value="Save" action="{!save}" />
                      <apex:pageblocksection >
                          Enter Name: <apex:inputText value="{!Account.Name}"/>
                      </apex:pageblocksection>
              </apex:pageBlock>
      </apex:pageBlock>
  </apex:form>
</apex:page>
 
Hi,
Below is code which I got from blog, in that code can anyone explain me Why
PageReference prf = null; is written.
Why it can not be written as PageReference prf = new Pagereference();
in saverec(),

public class ActionFunctionCLS {
  public Account actObj{get;set;}
    PageReference prf= null;
    public ActionFunctionCLS(){
      actObj = new Account();
    }
 
   
    public pagereference Saverec(){
  
   if(actobj.Name !=''){
    insert actobj;
   
   }
   else{
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error: Please Enter Name.');
     ApexPages.addMessage(myMsg);
   
   }
  return prf;
}
Hi,
I want to work on below task, Can anyone please help me in that task

Create a visual force page with two page blocks, one showing the existing Accounts and another for inserting new accounts. The inserted account also needs to be dynamically displayed in the existing Account list.

Thanks in Advance.
Hi,
I am trying to insert the record using Action Function,
I am getting the below error:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account Number should be Numeric.: []
Error is in expression '{!Saverec}' in page action_function_demo: Class.ActionFunctionCLS.Saverec: line 11, column 1
Class.ActionFunctionCLS.Saverec: line 11, column 1

Below is my Code:
<apex:page controller="ActionFunctionCLS" id="pg" >
  <script>
   function recSave(){
    var accountType = document.getElementById('pg:fm:pb:pbs:actType').value;
   // alert('accountType -->'+accountType);
    if(accountType != 'Prospect'){
     alert("You Should Select Prospect to Save the Record");
     return false;
    }
    else{
     saveAccount(); //this is the function name which calls our action function from java Script.
     return true;
    }
   }
 
  </script>

 <apex:form id="fm">
  <apex:actionfunction name="saveAccount" action="{!Saverec}" />
   <apex:pageBlock id="pb">
     <apex:pagemessages ></apex:pagemessages>
     <apex:pageblockButtons >
      <apex:commandButton value="Save" onclick="recSave(); return false;" />    
      
      
     </apex:pageblockButtons>
    
     <apex:pageblockSection id="pbs">
       <apex:inputField value="{!actobj.Name}" id="actName"/>
       <apex:inputField value="{!actobj.type}" id="actType"/>
     </apex:pageblockSection>
   </apex:pageBlock>
 </apex:form>
</apex:page>
---------------------------------------------
public class ActionFunctionCLS {
  public Account actObj{get;set;}
   PageReference prf= null;
    public ActionFunctionCLS(){
      actObj = new Account();
    }
 
   
    public pagereference Saverec(){
   if(actobj.Name !=''){
    insert actobj;
   
   }
   else{
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error: Please Enter Name.');
     ApexPages.addMessage(myMsg);
   //return prf;
   }
   if(actobj.id !=null){
 
      // Send the user to the detail page for the new account.
      prf = new PageReference('/'+actobj.id);
      prf.setRedirect(true);
   
   }
   return prf;
    
}
}
Can anyone help me to solve this error.
Thanks in avance
Hi,
I have a below requirenment
 
  1. Render VF page as PDF
  2. Create a custom button on opportunity object which will redirect user to a VF page which will populate some opportunity fields and a table showing related opportunity product details in PDF form.
  3. Opportunity fields to populate
    • Opportunity Name
    • Parent Account Name
  4. There will be another section on this page which will populate the details of all the products related to opportunity.
  5. Show product details in a table populating following opportunity product fields
  6. This VF page should open in PDF format.
 
Can anyone help me!!!!!!!!!!!!!!
Thanks in Advance

 
Hi,
I am using SOQL query to retrive all the class methods,
SOQL query ========= "select id,name,Body from apexclass''

Can someone help me to retrive all the class methods and variables using SOQL
Thanks
 
Hi,
Below is my Code: I am getting the error:method does not exist or incorrect signature: void clear() from the type string
Can anyone please help me.

<apex:page controller="Picklist_Controller">
    <apex:form>
        <apex:pageBlock>
          <apex:commandButton value="Show" action="{!Show}"/>
            <apex:pageBlockSection title="Countries">
                <apex:outputLabel>Country:</apex:outputLabel>
            <apex:selectList size="1" value="{!Countries}">
                <apex:selectOptions value="{!selectCountries}"/>
            </apex:selectList>
                </apex:pageBlockSection>
          <!--  <apex:selectList value="{!genders}" size="1">
                <apex:selectRadio value="{!Selectgender}"></apex:selectRadio>
            </apex:selectList>-->
            <apex:pageBlockSection title="Hobbies">
                  <apex:outputLabel>Hobby:</apex:outputLabel>
            <apex:selectList value="{!Hobby}" size="1">
                  <apex:selectOption itemLabel="--None--" itemvalue="None"></apex:selectOption>
                <apex:selectOption itemLabel="Swimming" itemvalue="Swimming"></apex:selectOption>
                <apex:selectOption itemLabel="Reading" itemvalue="Reading"></apex:selectOption>
                <apex:selectOption itemLabel="Cricket" itemvalue="Cricket"></apex:selectOption>
            </apex:selectList>
                </apex:pageBlockSection>
        </apex:pageBlock>
            <apex:pageBlock>
                <apex:pageBlockSection>
                    <apex:commandButton action="{!Erase}" value="Clear"/>
                </apex:pageBlockSection>
                <apex:outputText value="{!SelectedValues}" style="Color:Red"></apex:outputText>
            </apex:pageBlock>
    </apex:form>
</apex:page>
----------------------------------------------------------------------
public class Picklist_Controller {
    public List<SelectOption> selectCountries{get;set;}
  //  public List<SelectOption> selectGender{get;set;}
    public List<SelectOption> selecthobbies{get;set;}
    
    public String Countries{get;set;}
 //   public String genders{get;set;}
    public String Hobby{get;set;}
    public String selectedValues{get;set;}
    
    public Picklist_Controller(){
        selectCountries = new List<SelectOption>();
       // selectGender = new List<SelectOption>();
        selectHobbies = new List<SelectOption>();
       // selectedValues = new String();
     
        selectCountries.add(new SelectOption('---None--', 'None'));
        selectCountries.add(new SelectOption('India','India'));
        selectCountries.add(new SelectOption('USA','USA'));
        selectCountries.add(new SelectOption('UK','UK'));
        
      /*  selectGender.add(new SelectOption('Male','Male'));
        selectGender.add(new SelectOption('Female','Female'));*/
        
     /*   selectHobbies.add(new SelectOption('Reading','Reading'));
         selectHobbies.add(new SelectOption('Swimming','Swimming'));
         selectHobbies.add(new SelectOption('Dancing','Dancing'));
         selectHobbies.add(new SelectOption('Traveling','Traveling'));*/
    }
    
    public void Show(){
        selectedValues = 'Selected country:'+countries +'--------'+'Selected Hobby:'+Hobby;
 // return null;

    }
    public void Erase(){
          selectedValues.Clear();
  }
    
}
Hi,
I want to work on below task, Can anyone please help me in that task

Create a visual force page with two page blocks, one showing the existing Accounts and another for inserting new accounts. The inserted account also needs to be dynamically displayed in the existing Account list.

Thanks in Advance.
Hi,
I am trying to insert the record using Action Function,
I am getting the below error:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account Number should be Numeric.: []
Error is in expression '{!Saverec}' in page action_function_demo: Class.ActionFunctionCLS.Saverec: line 11, column 1
Class.ActionFunctionCLS.Saverec: line 11, column 1

Below is my Code:
<apex:page controller="ActionFunctionCLS" id="pg" >
  <script>
   function recSave(){
    var accountType = document.getElementById('pg:fm:pb:pbs:actType').value;
   // alert('accountType -->'+accountType);
    if(accountType != 'Prospect'){
     alert("You Should Select Prospect to Save the Record");
     return false;
    }
    else{
     saveAccount(); //this is the function name which calls our action function from java Script.
     return true;
    }
   }
 
  </script>

 <apex:form id="fm">
  <apex:actionfunction name="saveAccount" action="{!Saverec}" />
   <apex:pageBlock id="pb">
     <apex:pagemessages ></apex:pagemessages>
     <apex:pageblockButtons >
      <apex:commandButton value="Save" onclick="recSave(); return false;" />    
      
      
     </apex:pageblockButtons>
    
     <apex:pageblockSection id="pbs">
       <apex:inputField value="{!actobj.Name}" id="actName"/>
       <apex:inputField value="{!actobj.type}" id="actType"/>
     </apex:pageblockSection>
   </apex:pageBlock>
 </apex:form>
</apex:page>
---------------------------------------------
public class ActionFunctionCLS {
  public Account actObj{get;set;}
   PageReference prf= null;
    public ActionFunctionCLS(){
      actObj = new Account();
    }
 
   
    public pagereference Saverec(){
   if(actobj.Name !=''){
    insert actobj;
   
   }
   else{
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error: Please Enter Name.');
     ApexPages.addMessage(myMsg);
   //return prf;
   }
   if(actobj.id !=null){
 
      // Send the user to the detail page for the new account.
      prf = new PageReference('/'+actobj.id);
      prf.setRedirect(true);
   
   }
   return prf;
    
}
}
Can anyone help me to solve this error.
Thanks in avance