• venkatasubhashk
  • NEWBIE
  • 5 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 26
    Replies

 

The "Save and Add Button" is not appearing when i switch the user to a different profile called "Chatter Plus" in Salesforce.The button is on Visualforce page,its is a apex command button.

I have allowed ALL Apex and Visualforce permissions for this profile, but it still doesn't work.
The Edition is Enterprise Edition.

hi

 

 i am unable to save stagename when saved,but closedate if i change its getting saved...

 

public class Oppctrl
{

  


   


    public PageReference save() {
    
        update opps;
       
     update oppli;
   
  return null;
   
    }
    
public Opportunity Op ;
public Opportunity[] Opps ;
public OpportunitylineItem[] Oppli ;
public OpportunitylineItem[] Oli ;


 
public Oppctrl()
{

this.id =ApexPages.currentPage().getParameters().get('id');
op =[select id,name,Total_Invoiced__c,Total_Planned__c,Total_Submitted__c,ownerid,Purchase_order__c,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
oli = [select id,Quantity,delete__c ,pricebookentry.name,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid=:id];
opps =[select id,ownerid,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where Header_Opportunity__c =:id];

oppli = [select id,Line_Item_Total__c ,Quantity,delete__c ,description,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid in: opps];
//oppli = [select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid in:opps or Product_Code__c =: opps[0].name];

}
public String getname()
{
return 'Oppctrl';
}
public Opportunity getop()
{
return op;
}

public Opportunity [] getopps()
{
return opps;
}

public OpportunitylineItem[] getoppli()
{

return oppli;
}
public OpportunitylineItem[] getoli()
{

return oli;
}


}

 

<apex:page controller="Oppctrl" sidebar="false">
 
<apex:form >

<apex:pageMessages />
<apex:pageBlock title="Manage Billings">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>

</apex:pageBlockButtons>



<table border='0' style="empty-cells: hide" align='left' >


<tr bgcolor='#C0C0C0 '>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<tr>
<td></td>
<td><b> Opportunity Owner </b></td>
<td><apex:outputField value=" {!op.ownerid}"/></td>
<td><b> Total </b></td>
<td>  
   
<apex:outputPanel id="gt">
 <!--<apex:outputText value="val:{!gtotal}"/> -->
<apex:outputText value="{!gtotal}"/>
</apex:outputPanel>

      </td>   
</tr>

<tr>
<td></td>
<td><b>Opportunity Name</b></td>
<!--<td><apex:outputField value="{!op.Name}"/></td> -->
<td><apex:outputLink value="/{!op.id}" target="_blank">{!op.name}</apex:outputLink></td>
<td><b>Planned</b></td>
<!--<td>{!op.Total_Planned__c}</td>-->

<td>
NULL
</td>

</tr>

<tr>
<td></td>
<td><b>Account</b></td>
<td><apex:outputField value="{!op.Accountid}"/></td>
<td><b>Submitted</b></td>
<td>{!op.Total_Submitted__c}</td>
</tr>

<tr>
<td></td>
<td><b>Billing Contact</b></td>
<td><apex:outputField value="{!op.Billing_Contact__c}"/></td>
<td><b>Invoiced</b></td>
<td>{!op.Total_Invoiced__c}</td>
</tr>

<tr>
<td></td>
<td><b>Purchase Order</b></td>
<td><apex:outputField value="{!op.Purchase_order__c}"/></td>
<td><b>Difference</b></td>
<td>Difference</td>
</tr>

<tr>
<td></td>

<td></td>
<td></td>
</tr>
<tr><td></td></tr>
<tr>

<th></th>
<th bgcolor='#C0C0C0 '>Product</th>
<th bgcolor='#C0C0C0 '>Unit Price</th>
<th bgcolor='#C0C0C0 '>Quantity</th>
<th></th>


<th></th>
</tr>
<apex:repeat value="{!oli}" var="l">
<tr>
<td>
</td>
<td><apex:outputField value="{!l.Pricebookentry.name}"/></td>
<td><apex:outputField value="{!l.unitprice}"/></td>
<td><apex:outputField value="{!l.quantity}"/></td>
</tr>
</apex:repeat>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>

<tr>
<apex:repeat value="{!opps}" var="q">
<tr bgcolor='#E0FFFF'>

<th>Opportunity Name</th>
<!--<th>Header Opportunity</th>-->
<th>Stage</th>
<!--<th>Account</th>-->
<th>Closedate</th>

<th>Amount</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>

<td><b><apex:outputField value=" {!q.name}"/></b></td>
<!-- <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td> -->
<td> <apex:inputfield value=" {!q.stagename}"/> 
 

</td>

<td> <apex:inputField value="{!q.CloseDate}"/> 

</td> 


<td>action support</td>

<tr bgcolor='#E0FFFF'>

<th></th>
<th>Delete</th>
<th>Product</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Description</th>

<th></th>
 <th></th> <th></th>
</tr>


<apex:repeat value="{!oppli}" var="qa" >
 <apex:outputPanel rendered="{!IF((qa.Opportunityid == q.id),true,false)}">
 <!-- <apex:repeat value="{!oppli}" var="qa" rendered="{if (oppli.Opportunityid == opps.id),true,false}"> -->
<tr>
<td>
</td>
<td>
<apex:inputField value="{!qa.Delete__c}"/>
</td>

<td><apex:outputField value="{!qa.Product_Code__c}"/></td>
<td><apex:inputField value="{!qa.unitprice}"/></td>




<td><apex:inputField value="{!qa.quantity}">
<apex:actionSupport event="onchange" action="{!grandtotal}" rerender="gt"  status="wait"/>
<apex:actionStatus id="wait" startText=" (pls wait...)"/> 
<apex:actionSupport event="onmousemove" action="{!incrementCounter}" rerender="counter"  status="wait1"/>
<apex:actionStatus id="wait1" startText="(pls wait individual...)"/> 
</apex:inputField>

 </td>
<td>
<apex:outputField value="{!qa.description}"/>
</td>

<td>

<apex:inputCheckBox value="{!qa.Delete__c}" id="primaryCheckBox" disabled="{!NOT(qa.Delete__c)}" onclick="deSelectOthers(this)" />
</td>

<td>
<apex:outputPanel id="counter">
<apex:outputText value="Calc!:{!countindvidual}"/>
</apex:outputPanel>



</td>





</tr>
</apex:outputpanel>
</apex:repeat>




</apex:repeat>

</tr>

</table>
     

</apex:pageBlock> 

</apex:form>
</apex:page>

 when i hit save the changed closedate on visualforce is saved on record but stagename is not changed

 

i have opportunity lookup on Opportunity..





 

hi

 

i have follwing code , when saved it is taking the valuse from controller but not from the form

 

i used Apex repete here

 

and when i use apex page block table i am able to save the values from Form also..

 is there a way to save values through apex repete also...

 

<apex:page standardController="Opportunity" extensions="TVA_Billing_Itemssubhash" sidebar="false">
<apex:form>
 <apex:pageMessages />
 <apex:pageBlock title="Add Billing Items">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rerender="error" />
            </apex:pageBlockButtons>
   <table border='0'>
  
  <tr>
   <apex:repeat value="{!opps}" var="q">
   <tr bgcolor='#E0FFFF'>
  <th>Opportunity Name</th>
  <th>Header Opportunity</th>
  <th>Stage</th>
  <th>Account</th>
  <th>Closedate</th>
  <th>Probability</th>
  <th>Amount</th>
  </tr>
  <td><apex:outputField value=" {!q.name}"/></td>
  <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td>
  <td><apex:inputField value=" {!q.stagename}"/>  </td>
  <td> <apex:inputField value=" {!q.Accountid}"/>   </td>
  <td> <apex:inputField value="{!q.CloseDate}"/>   </td>  
  <td>  <apex:inputField value="{!q.Probability}"/> </td>   
  <td>  <apex:inputField value="{!q.amount}"/>   </td> 
  
  
  <tr bgcolor='#E0FFFF'>
  
   <th></th>
   <th>Product</th>
    <th>Unit Price</th>
    <th>Quantity</th>
     <th></th> <th></th> <th></th>
   </tr>
   <apex:repeat value="{!oppli}" var="qa" rows="{!opportunity.Opp_Line_Items_Count__c}">
   
   <tr>
  <td>
  </td>
   <td><apex:outputField value=" {!qa.Product_Code__c}"/></td>
   <td><apex:inputField value=" {!qa.unitprice}"/></td>
    <td><apex:inputField value=" {!qa.quantity}"/></td>

 </tr>
 </apex:repeat>
 
   
  
   
   </apex:repeat>
   
  </tr>
   
   </table>
   
            </apex:pageBlock>
   
    </apex:form>
</apex:page>

 

public class TVA_Billing_Itemssubhash {

   public List<Opportunity> Opps  {get; set;}
    
    static Integer cnt2;
  public List<OpportunitylineItem> Oppli  {get; set;}
    public  Opportunity [] op;
    
    
   
    string id;
    decimal i =0; 
    decimal j = 0;
  
    public TVA_Billing_Itemssubhash (ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    //current page Opportunity and Opp Line Items and Price Book Entry ID
    Opportunity o =[select id,name,date_of_close_date__c ,Final_Closed_Date__c,Week_End_Day__c,Estimated_Start_Date__c,Account.name,Round_off__c,Year_of_close_date__c,Month_Of_Closedate__c,stagename,CloseDate,pricebook2id,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Product_Name__c,TotalPrice,ListPrice,PricebookEntry.name,Quantity,PricebookEntry.Product2.Name , PricebookEntry.Product2.id, UnitPrice,PricebookEntryId,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    
 
  
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
    
         
       
       
        
        for(i=0;i<o.No_Of_Months_for_Billing__c;i++)
        {
       
     
         Opportunity LitOrd = new Opportunity();
         LitOrd.stagename = 'Billing-Planned';
      
         LitOrd.probability =100;
         LitOrd.amount = o.amount;
       
        LitOrd.closedate = o.closedate;
        
       
      
         Opps.add(LitOrd);
          }
          
         
        for(j=0;j<((o.Opp_Line_Items_Count__c/oli.size())*o.No_Of_Months_for_Billing__c);j++){
        
         for(opportunitylineitem oli1:oli){

         OpportunitylineItem LitOrdch = new OpportunitylineItem();
                  
       
         LitOrdch.quantity = oli1.quantity;
         LitOrdch.unitprice = oli1.unitprice; 
     
         LitOrdch.opportunityid = o.id;
       
       
        LitOrdch.PricebookEntryId=oli1.PricebookEntryId;
        LitOrdch.Product_Code__c = oli1.PricebookEntry.name;
       
    
         Oppli.add(LitOrdch); 
         
        }
       }
       
       
       }   
     

   
    public PageReference save() 
    {
       
     try{     
         insert opps;
         
           insert Oppli;
          
          
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 
        
        }

 

 

hi

 

i have follwing code , when saved it is taking the valuse from controller but not from the form

 

i used Apex repete here

 

and when i use apex page block table i am able to save the values from Form also..

 is there a way to save values through apex repete also...

<apex:page standardController="Opportunity" extensions="TVA_Billing_Itemssubhash" sidebar="false">
<apex:form>
 <apex:pageMessages />
 <apex:pageBlock title="Add Billing Items">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rerender="error" />
            </apex:pageBlockButtons>
   <table border='0'>
  
  <tr>
   <apex:repeat value="{!opps}" var="q">
   <tr bgcolor='#E0FFFF'>
  <th>Opportunity Name</th>
  <th>Header Opportunity</th>
  <th>Stage</th>
  <th>Account</th>
  <th>Closedate</th>
  <th>Probability</th>
  <th>Amount</th>
  </tr>
  <td><apex:outputField value=" {!q.name}"/></td>
  <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td>
  <td><apex:inputField value=" {!q.stagename}"/>  </td>
  <td> <apex:inputField value=" {!q.Accountid}"/>   </td>
  <td> <apex:inputField value="{!q.CloseDate}"/>   </td>  
  <td>  <apex:inputField value="{!q.Probability}"/> </td>   
  <td>  <apex:inputField value="{!q.amount}"/>   </td> 
  
  
  <tr bgcolor='#E0FFFF'>
  
   <th></th>
   <th>Product</th>
    <th>Unit Price</th>
    <th>Quantity</th>
     <th></th> <th></th> <th></th>
   </tr>
   <apex:repeat value="{!oppli}" var="qa" rows="{!opportunity.Opp_Line_Items_Count__c}">
   
   <tr>
  <td>
  </td>
   <td><apex:outputField value=" {!qa.Product_Code__c}"/></td>
   <td><apex:inputField value=" {!qa.unitprice}"/></td>
    <td><apex:inputField value=" {!qa.quantity}"/></td>

 </tr>
 </apex:repeat>
 
   
  
   
   </apex:repeat>
   
  </tr>
   
   </table>
   
            </apex:pageBlock>
   
    </apex:form>
</apex:page>

 

public class TVA_Billing_Itemssubhash {

   public List<Opportunity> Opps  {get; set;}
    
    static Integer cnt2;
  public List<OpportunitylineItem> Oppli  {get; set;}
    public  Opportunity [] op;
    
    
   
    string id;
    decimal i =0; 
    decimal j = 0;
  
    public TVA_Billing_Itemssubhash (ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    //current page Opportunity and Opp Line Items and Price Book Entry ID
    Opportunity o =[select id,name,date_of_close_date__c ,Final_Closed_Date__c,Week_End_Day__c,Estimated_Start_Date__c,Account.name,Round_off__c,Year_of_close_date__c,Month_Of_Closedate__c,stagename,CloseDate,pricebook2id,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Product_Name__c,TotalPrice,ListPrice,PricebookEntry.name,Quantity,PricebookEntry.Product2.Name , PricebookEntry.Product2.id, UnitPrice,PricebookEntryId,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    
 
  
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
    
         
       
       
        
        for(i=0;i<o.No_Of_Months_for_Billing__c;i++)
        {
       
     
         Opportunity LitOrd = new Opportunity();
         LitOrd.stagename = 'Billing-Planned';
      
         LitOrd.probability =100;
         LitOrd.amount = o.amount;
       
        LitOrd.closedate = o.closedate;
        
       
      
         Opps.add(LitOrd);
          }
          
         
        for(j=0;j<((o.Opp_Line_Items_Count__c/oli.size())*o.No_Of_Months_for_Billing__c);j++){
        
         for(opportunitylineitem oli1:oli){

         OpportunitylineItem LitOrdch = new OpportunitylineItem();
                  
       
         LitOrdch.quantity = oli1.quantity;
         LitOrdch.unitprice = oli1.unitprice; 
     
         LitOrdch.opportunityid = o.id;
       
       
        LitOrdch.PricebookEntryId=oli1.PricebookEntryId;
        LitOrdch.Product_Code__c = oli1.PricebookEntry.name;
       
    
         Oppli.add(LitOrdch); 
         
        }
       }
       
       
       }   
     

   
    public PageReference save() 
    {
       
     try{     
         insert opps;
         
           insert Oppli;
          
          
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 
        
        }

 

hi

 

i have follwing code , when saved it is taking the valuse from controller but not from the form

 

i used Apex repete here

 

and when i use apex page block table i am able to save the values from Form also..

 

is there a way to save values through apex repete also...

 

 

<apex:page standardController="Opportunity" extensions="TVA_Billing_Itemssubhash" sidebar="false">
<apex:form>
 <apex:pageMessages />
 <apex:pageBlock title="Add Billing Items">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rerender="error" />
            </apex:pageBlockButtons>
   <table border='0'>
  
  <tr>
   <apex:repeat value="{!opps}" var="q">
   <tr bgcolor='#E0FFFF'>
  <th>Opportunity Name</th>
  <th>Header Opportunity</th>
  <th>Stage</th>
  <th>Account</th>
  <th>Closedate</th>
  <th>Probability</th>
  <th>Amount</th>
  </tr>
  <td><apex:outputField value=" {!q.name}"/></td>
  <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td>
  <td><apex:inputField value=" {!q.stagename}"/>  </td>
  <td> <apex:inputField value=" {!q.Accountid}"/>   </td>
  <td> <apex:inputField value="{!q.CloseDate}"/>   </td>  
  <td>  <apex:inputField value="{!q.Probability}"/> </td>   
  <td>  <apex:inputField value="{!q.amount}"/>   </td> 
  
  
  <tr bgcolor='#E0FFFF'>
  
   <th></th>
   <th>Product</th>
    <th>Unit Price</th>
    <th>Quantity</th>
     <th></th> <th></th> <th></th>
   </tr>
   <apex:repeat value="{!oppli}" var="qa" rows="{!opportunity.Opp_Line_Items_Count__c}">
   
   <tr>
  <td>
  </td>
   <td><apex:outputField value=" {!qa.Product_Code__c}"/></td>
   <td><apex:inputField value=" {!qa.unitprice}"/></td>
    <td><apex:inputField value=" {!qa.quantity}"/></td>

 </tr>
 </apex:repeat>
 
   
  
   
   </apex:repeat>
   
  </tr>
   
   </table>
   
            </apex:pageBlock>
   
    </apex:form>
</apex:page>
 

 

public class TVA_Billing_Itemssubhash {

   public List<Opportunity> Opps  {get; set;}
    
    static Integer cnt2;
  public List<OpportunitylineItem> Oppli  {get; set;}
    public  Opportunity [] op;
    
    
   
    string id;
    decimal i =0; 
    decimal j = 0;
  
    public TVA_Billing_Itemssubhash (ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    //current page Opportunity and Opp Line Items and Price Book Entry ID
    Opportunity o =[select id,name,date_of_close_date__c ,Final_Closed_Date__c,Week_End_Day__c,Estimated_Start_Date__c,Account.name,Round_off__c,Year_of_close_date__c,Month_Of_Closedate__c,stagename,CloseDate,pricebook2id,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Product_Name__c,TotalPrice,ListPrice,PricebookEntry.name,Quantity,PricebookEntry.Product2.Name , PricebookEntry.Product2.id, UnitPrice,PricebookEntryId,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    
 
  
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
    
         
       
       
        
        for(i=0;i<o.No_Of_Months_for_Billing__c;i++)
        {
       
     
         Opportunity LitOrd = new Opportunity();
         LitOrd.stagename = 'Billing-Planned';
      
         LitOrd.probability =100;
         LitOrd.amount = o.amount;
       
        LitOrd.closedate = o.closedate;
        
       
      
         Opps.add(LitOrd);
          }
          
         
        for(j=0;j<((o.Opp_Line_Items_Count__c/oli.size())*o.No_Of_Months_for_Billing__c);j++){
        
         for(opportunitylineitem oli1:oli){

         OpportunitylineItem LitOrdch = new OpportunitylineItem();
                  
       
         LitOrdch.quantity = oli1.quantity;
         LitOrdch.unitprice = oli1.unitprice; 
     
         LitOrdch.opportunityid = o.id;
       
       
        LitOrdch.PricebookEntryId=oli1.PricebookEntryId;
        LitOrdch.Product_Code__c = oli1.PricebookEntry.name;
       
    
         Oppli.add(LitOrdch); 
         
        }
       }
       
       
       }   
     

   
    public PageReference save() 
    {
       
     try{     
         insert opps;
         
           insert Oppli;
          
          
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 
        
        }

 

HI,
I cerated a controller where i add New Opportunities on a Visual force Page ,
i have a field closedate which i should iterate and set to 20 th of every month 
i have code like this


for(i=0;i<14;i++) 

{        

Opportunity LitOrd = new Opportunity();
 LitOrd.closedate = o.closedate;
 Opps.add(LitOrd);

}


so for 10 opportunities i am getting closedate as the current page closedate from where button is clicked on a Opportunity


is there a way i can get 20 th of every month for 14 months


say CLosedate = 1/1/2011


so for 14 months i should get like following on VF Page... 


1)  closedate = 20/01/2011

2)  closedate = 20/02/2011

3)  closedate = 20/03/2011

4)  closedate = 20/04/2011

5)  closedate = 20/05/2011

6)  closedate = 20/06/2011

7)  closedate = 20/07/2011

8)  closedate = 20/08/2011

9)  closedate = 20/09/2011

10) closedate = 20/10/2011

11) closedate = 20/11/2011

12) closedate = 20/12/2011
13) closedate = 20/01/2012

14) closedate = 20/02/2012


is there a way to chieve this in Class or Visualforce page Level

HI,
I cerated a controller where i add New Opportunities on a Visual force Page ,
i have a field closedate which i should iterate and set to 20 th of every month 
i have code like this


for(i=0;i<14;i++) {       

 Opportunity LitOrd = new Opportunity();
 LitOrd.closedate = o.closedate;
 Opps.add(LitOrd);

}


so for10 opportunities i am getting closedate as the current page closedate from where button is clicked on a Opportunity

is there a way i can get 20 th of every month for 14 months


say CLosedate = 1/1/2011


so for 14 months i should get like following on VF Page... 


1)  closedate = 20/01/2011

2)  closedate = 20/02/2011

3)  closedate = 20/03/2011

4)  closedate = 20/04/2011

5)  closedate = 20/05/2011

6)  closedate = 20/06/2011

7)  closedate = 20/07/2011

8)  closedate = 20/08/2011

9)  closedate = 20/09/2011

10) closedate = 20/10/2011

11) closedate = 20/11/2011

12) closedate = 20/12/2011
13) closedate = 20/01/2012

14) closedate = 20/02/2012


is there a way to chieve this in Class or Visualforce page Level

HI,

 

I cerated a controller where i add New Opportunities on a Visual force Page ,

 

i have a field closedate which i should iterate and set to 20 th of every month 

 

i have code like this

 

for(i=0;i<14;i++)

 {       

 Opportunity LitOrd = new Opportunity();

 

 LitOrd.closedate = o.closedate;

 

 Opps.add(LitOrd);

}

 

so for 10 opportunities i am getting closedate as the current page closedate from where button is clicked on a Opportunity

 

is there a way i can get 20 th of every month for 14 months

 

say CLosedate = 1/1/2011

 

so for 14 months i should get like following on VF Page... 

 

1)  closedate = 20/01/2011

2)  closedate = 20/02/2011

3)  closedate = 20/03/2011

4)  closedate = 20/04/2011

5)  closedate = 20/05/2011

6)  closedate = 20/06/2011

7)  closedate = 20/07/2011

8)  closedate = 20/08/2011

9)  closedate = 20/09/2011

10) closedate = 20/10/2011

11) closedate = 20/11/2011

12) closedate = 20/12/2011

 

13) closedate = 20/01/2012

14) closedate = 20/02/2012

 

is there a way to chieve this in Class or Visualforce page Level

Hi,

I created a vf page to insert Opportunities and Opportunityline items.

i am unable to Map the Right parent to right child.

my code is

 

Apex class

public class TVA_Billing_Items {

    public List<Opportunity> Opps  {get; set;}
    public List<OpportunitylineItem> Oppli  {get; set;}
   
    string id;
    decimal i =0; 
    decimal j = 0;
    
    public TVA_Billing_Items(ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
     Opportunity o =[select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
     
     i = o.No_Of_Months_for_Billing__c;
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
     
     for(i=0;i<o.No_Of_Months_for_Billing__c;i++){
     Opportunity LitOrd = new Opportunity();
      Opps.add(LitOrd);
      
       for(j=0;j<o.Opp_Line_Items_Count__c;j++){
          
             OpportunitylineItem LitOrdch = new OpportunitylineItem();
           
             Oppli.add(LitOrdch); 
          
        
        } 
       
       }
       }   
     

            
    public PageReference save() 
    {
    
     try{
     //Here I am Inserting the Opportunities first 
            insert Opps;
                    // for each Opp i am trying to insert OPplines but a//all lines are saved to first Opp  
             for(Opportunity Opps1 :Opps){
                       
             for(opportunityLineItem oppli1 :Oppli){
             Oppli1.OpportunityId = Opps1.id;
            
            }
            
            }
            
            insert Oppli;
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
   
        }

VF page

 

<apex:page standardController="Opportunity" extensions="TVA_Billing_Itemssubhash"  >
<apex:form >
    
    <apex:pageMessages />
    <apex:pageBlock title="Add Billing Items" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rerender="error" />
            </apex:pageBlockButtons>
            
            
            
            <apex:pageBlockTable value="{!Opps}" var="a" id="table" >
            
               
                
                 <apex:column headerValue="Header Opportunity">
                   
                    <apex:inputField value="{!a.Header_Opportunity__c}" required="true"/>
                    
                    </apex:column> 
                     
                      <apex:column headerValue="Billing Opp Name">
                   
                    <apex:inputField value="{!a.name}" required="true"/>
                    
                    </apex:column>  
                      <apex:column headerValue="Stage">
                   
                    <apex:inputField value="{!a.stagename}" required="true"/>
                    
                    </apex:column> 
                     <apex:column headerValue="Account">
                   
                    <apex:inputField value="{!a.Accountid}" required="true"/>
                    
                    </apex:column> 
                     <apex:column headerValue="Close Date">
                   
                    <apex:inputField value="{!a.CloseDate}" required="true"/>
                    
                    </apex:column> 
                     <apex:column headerValue="Probability">
                   
                    <apex:inputField value="{!a.Probability}" required="true"/>
                    
                    </apex:column>  
                   
                    <apex:column headerValue="Amount">
                      <apex:inputField value="{!a.amount}" required="true"/>
                     
                    </apex:column>  
                     
                    
                     
                  <apex:column headerValue="Quick Save">
                     <apex:commandLink value="Quick save" action="{!qsave}"/>
                     
                    </apex:column>  
                     
               
                  </apex:pageBlockTable>
                  
                  <apex:pageBlockTable value="{!Oppli}" var="b" id="table2" >
            
               
                
              <apex:column headerValue="Unit Price">
                   
                    <apex:inputField value="{!b.UnitPrice}" required="true"/>
                    
                    </apex:column>  
                    
                     <apex:column headerValue="Quantity">
                   
                    <apex:inputField value="{!b.Quantity}" required="true"/>
                    
                    </apex:column>  
                    <apex:column headerValue="Opportunity">
                   
                    <apex:inputField value="{!b.Opportunityid}" required="true"/>
                    
                    </apex:column>  
                    
                 
                 
                  </apex:pageBlockTable>
               
           
    <apex:pageblockButtons location="bottom">
        <div style="text-align:right;margin-right:30px;font-weight:bold;">
        <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" />
&nbsp;|&nbsp;&nbsp;
            <apex:commandLink value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />                         
        </div>
    </apex:pageblockButtons>  
    </apex:pageBlock>
    </apex:form>
</apex:page>

 any ideas to Map parent id to children

Is there a way i can create a Multiple Parents and childs at a time each corresponding to right parent..

Hi,

 

I want to create a custom visual force page to Create a Multiple Parent and Related Children, where on save i have to mach the parent id to corresponding children and save them too.

 

I Have code as Follows where on save all children are Mapped to First Parent Record....

 

 

public class TVA_Billing_Items {

    public List<Opportunity> Opps  {get; set;}
    public List<OpportunitylineItem> Oppli  {get; set;}
   
    string id;
    decimal i =0; 
    decimal j = 0;
    
    public TVA_Billing_Items(ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
     Opportunity o =[select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
     
     i = o.No_Of_Months_for_Billing__c;
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
     
     for(i=0;i<o.No_Of_Months_for_Billing__c;i++){
     Opportunity LitOrd = new Opportunity();
      Opps.add(LitOrd);
      
       for(j=0;j<o.Opp_Line_Items_Count__c;j++){
          
             OpportunitylineItem LitOrdch = new OpportunitylineItem();
           
             Oppli.add(LitOrdch); 
          
        
        } 
       
       }
       }   
     

            
    public PageReference save() 
    {
    
     try{
     
            insert Opps;
                      
             for(Opportunity Opps1 :Opps){
                       
             for(opportunityLineItem oppli1 :Oppli){
             Oppli1.OpportunityId = Opps1.id;
            
            }
            
            }
            
            insert Oppli;
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
   
        }

 

Hi,

 

I want to create a custom visual force page to Create a Multiple Parent and Related Children, where on save i have to mach the parent id to corresponding children and save them too.

 

I Have code as Follows where on save all children are Mapped to First Parent Record....

 

Is there a way i can create a Multiple Parents and childs at a time each corresponding to right parent..

 

public class TVA_Billing_Items {

    public List<Opportunity> Opps  {get; set;}
    public List<OpportunitylineItem> Oppli  {get; set;}
    
    string id;
    decimal i =0; 
    decimal j = 0;
    public TVA_Billing_Items(ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    Opportunity o =[select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    Pricebookentry p = [select id,name from Pricebookentry where PricebookEntry.IsActive = true limit 1 ];
    
     i = o.No_Of_Months_for_Billing__c;
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
     
     
    
     for(i=0;i<o.No_Of_Months_for_Billing__c;i++){
     Opportunity LitOrd = new Opportunity();
   // Opps = [select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c  from Opportunity where id=:id];
   //  LitOrd.Billing_Contact__c  = o.Billing_Contact__c;  
  
      Opps.add(LitOrd);
       for(j=0;j<o.Opp_Line_Items_Count__c;j++){
           // for(OpportunitylineItem oli1:oli){
            OpportunitylineItem LitOrdch = new OpportunitylineItem();
            //Oppli  =[select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c from OpportunityLineItem where Opportunityid=:LitOrd.id limit 1];
          
         
           // LitOrdch.Quote_Original_List_Price__c  = oli1.Quote_Original_List_Price__c ;
          
           //LitOrdch.opportunityid = LitOrd.id;
         // LitOrdch.opportunity=LItord.id;
          LitOrdch.PricebookEntryId=p.id;
          
            Oppli.add(LitOrdch); 
          
          // }
        } 
       
       }
       }   
     

    public void addrow() {
   
            Opportunity LitOrd = new Opportunity();
            //Opportunity LitOrd1 = new Opportunity();
            Opps.add(LitOrd);
            //Opps.add(LitOrd1);
       
        }
       
            
    public void removerow()
    {
        Integer i = Opps.size();
        Opps.remove(i-1);
    }
    
    
  
    
    
    
            
    public PageReference save() 
    {
    
   
     try{
     
            insert Opps;
            
           
            for(Opportunity Opps1 :Opps){
            
           
              for(opportunityLineItem oppli1 :Oppli){
             Oppli1.OpportunityId = Opps1.id;
            
            }
             //insert Oppli;
            }
            
            insert Oppli;
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 

 
 
 
        
        }

 

I have a Query like this ...

 

 

for(opportunity opp1 :opp){

ProcessInstance p= [SELECT Id, (SELECT Id, StepStatus,Comments FROM Steps)FROM ProcessInstance  WHERE Status='Approved' and  TargetObjectId=:opp1.id limit 1];

 

opp1.comments = p.comments; 

 

//This is not working

 

i want to get the comments from the Query to custom field

 

}

 

any ideas please!!

I have a Query like this ...

 

 

for(opportunity opp1 :opp){

ProcessInstance p= [SELECT Id, (SELECT Id, StepStatus,Comments FROM Steps)FROM ProcessInstance  WHERE Status='Approved' and  TargetObjectId=:opp1.id limit 1];

 

opp1.comments = p.comments; 

 

//This is not working

 

i want to get the comments from the Query to custom field

 

}

 

any ideas please!!

 

 

Hi
I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object
When i Scheduled it i am facing a New Error and my Job is Failing
The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"
any Ideas on this Error and to rectify it !
Scheduled Batch Apex Error

Hi
I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object
When i Scheduled it i am facing a New Error and my Job is Failing
The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"
any Ideas on this Error and to rectify it !

 

Hi

 

I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object

 

When i Scheduled it i am facing a New Error and my Job is Failing

 

The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"

 

any Ideas on this Error and to rectify it !

Hi,

 

 I created a custom List Button on Accounts ,which i placed it on Accounts View. when i Click that  i call a VF page

 

PAGE:

---------

 

<apex:page standardController="Account" contentType="text/csv#Contact.csv" cache="true" recordSetVar="Accounts"  extensions="Accounts_export">
Customer Name,
"Phone",
"Email Id",
"Billing Street",
"City",
"Billing State/Province",
"Zip/Postal Code"
<apex:repeat value="{!Accounts}" var="a">  
{!a.Name},
"{!a.Phone}",
"{!a.Business_Email__c}",
"{!a.BillingStreet}",
"{!a.BillingState}",
"{!a.BillingCity}",
"{!a.BillingPostalCode}"   
    
</apex:repeat>
</apex:page>
                 

 

and MY controller :

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

 

public class Accounts_export {

 

    public Accounts_export(ApexPages.StandardSetController controller) {

controller.setPageSize(4000);

    }

 

}

 

 

 

I am Facing problem to export 4000 records to CSV or Excel where i can export 2000 records sucessfully

 

The Error when i give size as 4000 is 

 

"system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: invalid batch size: 4000 

 

 

 

 

"

 

Any Ideas  Please

Hi,

 

 I created a custom List Button on Accounts ,which i placed it on Accounts View. when i Click that  i call a VF page

 

PAGE:

---------

 

<apex:page standardController="Account" contentType="text/csv#Contact.csv" cache="true" recordSetVar="Accounts"  extensions="Accounts_export">
Customer Name,
"Phone",
"Email Id",
"Billing Street",
"City",
"Billing State/Province",
"Zip/Postal Code"
<apex:repeat value="{!Accounts}" var="a">  
{!a.Name},
"{!a.Phone}",
"{!a.Business_Email__c}",
"{!a.BillingStreet}",
"{!a.BillingState}",
"{!a.BillingCity}",
"{!a.BillingPostalCode}"   
    
</apex:repeat>
</apex:page>
                 

 

and MY controller :

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

 

public class Accounts_export {

 

    public Accounts_export(ApexPages.StandardSetController controller) {

controller.setPageSize(4000);

    }

 

}

 

 

 

I am Facing problem to export 4000 records to CSV or Excel where i can export 2000 records sucessfully

 

The Error when i give size as 4000 is 

 

"system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: invalid batch size: 4000 

 

 

 

 

"

 

Any Ideas ! 

Hi,

 

 I created a custom List Button on Accounts ,which i placed it on Accounts View. when i Click that  i call a VF page

 

PAGE:

---------

 

<apex:page standardController="Account" contentType="text/csv#Contact.csv" cache="true" recordSetVar="Accounts"  extensions="Accounts_export">
Customer Name,
"Phone",
"Email Id",
"Billing Street",
"City",
"Billing State/Province",
"Zip/Postal Code"
<apex:repeat value="{!Accounts}" var="a">  
{!a.Name},
"{!a.Phone}",
"{!a.Business_Email__c}",
"{!a.BillingStreet}",
"{!a.BillingState}",
"{!a.BillingCity}",
"{!a.BillingPostalCode}"   
    
</apex:repeat>
</apex:page>
                 

 

and MY controller :

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

 

public class Accounts_export {

 

    public Accounts_export(ApexPages.StandardSetController controller) {

controller.setPageSize(4000);

    }

 

}

 

 

 

I am Facing problem to export 4000 records to CSV or Excel where i can export 2000 records sucessfully

 

The Error when i give size as 4000 is 

 

"system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: invalid batch size: 4000 

 

 

 

 

"

 

Any Ideas ! 

 

hi

 

i have follwing code , when saved it is taking the valuse from controller but not from the form

 

i used Apex repete here

 

and when i use apex page block table i am able to save the values from Form also..

 

is there a way to save values through apex repete also...

 

 

<apex:page standardController="Opportunity" extensions="TVA_Billing_Itemssubhash" sidebar="false">
<apex:form>
 <apex:pageMessages />
 <apex:pageBlock title="Add Billing Items">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}" rerender="error" />
            </apex:pageBlockButtons>
   <table border='0'>
  
  <tr>
   <apex:repeat value="{!opps}" var="q">
   <tr bgcolor='#E0FFFF'>
  <th>Opportunity Name</th>
  <th>Header Opportunity</th>
  <th>Stage</th>
  <th>Account</th>
  <th>Closedate</th>
  <th>Probability</th>
  <th>Amount</th>
  </tr>
  <td><apex:outputField value=" {!q.name}"/></td>
  <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td>
  <td><apex:inputField value=" {!q.stagename}"/>  </td>
  <td> <apex:inputField value=" {!q.Accountid}"/>   </td>
  <td> <apex:inputField value="{!q.CloseDate}"/>   </td>  
  <td>  <apex:inputField value="{!q.Probability}"/> </td>   
  <td>  <apex:inputField value="{!q.amount}"/>   </td> 
  
  
  <tr bgcolor='#E0FFFF'>
  
   <th></th>
   <th>Product</th>
    <th>Unit Price</th>
    <th>Quantity</th>
     <th></th> <th></th> <th></th>
   </tr>
   <apex:repeat value="{!oppli}" var="qa" rows="{!opportunity.Opp_Line_Items_Count__c}">
   
   <tr>
  <td>
  </td>
   <td><apex:outputField value=" {!qa.Product_Code__c}"/></td>
   <td><apex:inputField value=" {!qa.unitprice}"/></td>
    <td><apex:inputField value=" {!qa.quantity}"/></td>

 </tr>
 </apex:repeat>
 
   
  
   
   </apex:repeat>
   
  </tr>
   
   </table>
   
            </apex:pageBlock>
   
    </apex:form>
</apex:page>
 

 

public class TVA_Billing_Itemssubhash {

   public List<Opportunity> Opps  {get; set;}
    
    static Integer cnt2;
  public List<OpportunitylineItem> Oppli  {get; set;}
    public  Opportunity [] op;
    
    
   
    string id;
    decimal i =0; 
    decimal j = 0;
  
    public TVA_Billing_Itemssubhash (ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    //current page Opportunity and Opp Line Items and Price Book Entry ID
    Opportunity o =[select id,name,date_of_close_date__c ,Final_Closed_Date__c,Week_End_Day__c,Estimated_Start_Date__c,Account.name,Round_off__c,Year_of_close_date__c,Month_Of_Closedate__c,stagename,CloseDate,pricebook2id,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Product_Name__c,TotalPrice,ListPrice,PricebookEntry.name,Quantity,PricebookEntry.Product2.Name , PricebookEntry.Product2.id, UnitPrice,PricebookEntryId,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    
 
  
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
    
         
       
       
        
        for(i=0;i<o.No_Of_Months_for_Billing__c;i++)
        {
       
     
         Opportunity LitOrd = new Opportunity();
         LitOrd.stagename = 'Billing-Planned';
      
         LitOrd.probability =100;
         LitOrd.amount = o.amount;
       
        LitOrd.closedate = o.closedate;
        
       
      
         Opps.add(LitOrd);
          }
          
         
        for(j=0;j<((o.Opp_Line_Items_Count__c/oli.size())*o.No_Of_Months_for_Billing__c);j++){
        
         for(opportunitylineitem oli1:oli){

         OpportunitylineItem LitOrdch = new OpportunitylineItem();
                  
       
         LitOrdch.quantity = oli1.quantity;
         LitOrdch.unitprice = oli1.unitprice; 
     
         LitOrdch.opportunityid = o.id;
       
       
        LitOrdch.PricebookEntryId=oli1.PricebookEntryId;
        LitOrdch.Product_Code__c = oli1.PricebookEntry.name;
       
    
         Oppli.add(LitOrdch); 
         
        }
       }
       
       
       }   
     

   
    public PageReference save() 
    {
       
     try{     
         insert opps;
         
           insert Oppli;
          
          
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 
        
        }

 

Is there a way i can create a Multiple Parents and childs at a time each corresponding to right parent..

Hi,

 

I want to create a custom visual force page to Create a Multiple Parent and Related Children, where on save i have to mach the parent id to corresponding children and save them too.

 

I Have code as Follows where on save all children are Mapped to First Parent Record....

 

 

public class TVA_Billing_Items {

    public List<Opportunity> Opps  {get; set;}
    public List<OpportunitylineItem> Oppli  {get; set;}
   
    string id;
    decimal i =0; 
    decimal j = 0;
    
    public TVA_Billing_Items(ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
     Opportunity o =[select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
     
     i = o.No_Of_Months_for_Billing__c;
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
     
     for(i=0;i<o.No_Of_Months_for_Billing__c;i++){
     Opportunity LitOrd = new Opportunity();
      Opps.add(LitOrd);
      
       for(j=0;j<o.Opp_Line_Items_Count__c;j++){
          
             OpportunitylineItem LitOrdch = new OpportunitylineItem();
           
             Oppli.add(LitOrdch); 
          
        
        } 
       
       }
       }   
     

            
    public PageReference save() 
    {
    
     try{
     
            insert Opps;
                      
             for(Opportunity Opps1 :Opps){
                       
             for(opportunityLineItem oppli1 :Oppli){
             Oppli1.OpportunityId = Opps1.id;
            
            }
            
            }
            
            insert Oppli;
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
   
        }

 

Hi,

 

I want to create a custom visual force page to Create a Multiple Parent and Related Children, where on save i have to mach the parent id to corresponding children and save them too.

 

I Have code as Follows where on save all children are Mapped to First Parent Record....

 

Is there a way i can create a Multiple Parents and childs at a time each corresponding to right parent..

 

public class TVA_Billing_Items {

    public List<Opportunity> Opps  {get; set;}
    public List<OpportunitylineItem> Oppli  {get; set;}
    
    string id;
    decimal i =0; 
    decimal j = 0;
    public TVA_Billing_Items(ApexPages.StandardController myController) 
    {
    this.id = ApexPages.currentPage().getParameters().get('id');
    Opportunity o =[select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
    OpportunitylineItem[] oli = [select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c  from OpportunityLineItem where Opportunityid=:o.id] ;
    Pricebookentry p = [select id,name from Pricebookentry where PricebookEntry.IsActive = true limit 1 ];
    
     i = o.No_Of_Months_for_Billing__c;
     Opps = new List<Opportunity>();
     Oppli =new List<OpportunitylineItem>();
     
     
    
     for(i=0;i<o.No_Of_Months_for_Billing__c;i++){
     Opportunity LitOrd = new Opportunity();
   // Opps = [select id,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c  from Opportunity where id=:id];
   //  LitOrd.Billing_Contact__c  = o.Billing_Contact__c;  
  
      Opps.add(LitOrd);
       for(j=0;j<o.Opp_Line_Items_Count__c;j++){
           // for(OpportunitylineItem oli1:oli){
            OpportunitylineItem LitOrdch = new OpportunitylineItem();
            //Oppli  =[select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c from OpportunityLineItem where Opportunityid=:LitOrd.id limit 1];
          
         
           // LitOrdch.Quote_Original_List_Price__c  = oli1.Quote_Original_List_Price__c ;
          
           //LitOrdch.opportunityid = LitOrd.id;
         // LitOrdch.opportunity=LItord.id;
          LitOrdch.PricebookEntryId=p.id;
          
            Oppli.add(LitOrdch); 
          
          // }
        } 
       
       }
       }   
     

    public void addrow() {
   
            Opportunity LitOrd = new Opportunity();
            //Opportunity LitOrd1 = new Opportunity();
            Opps.add(LitOrd);
            //Opps.add(LitOrd1);
       
        }
       
            
    public void removerow()
    {
        Integer i = Opps.size();
        Opps.remove(i-1);
    }
    
    
  
    
    
    
            
    public PageReference save() 
    {
    
   
     try{
     
            insert Opps;
            
           
            for(Opportunity Opps1 :Opps){
            
           
              for(opportunityLineItem oppli1 :Oppli){
             Oppli1.OpportunityId = Opps1.id;
            
            }
             //insert Oppli;
            }
            
            insert Oppli;
        }    

      catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Oops An Error Occured!'));
      return null;
    } 
     
         return(new ApexPages.StandardController(Opps[0])).view();
       
 }
 
 

 
 
 
        
        }

 

I have a Query like this ...

 

 

for(opportunity opp1 :opp){

ProcessInstance p= [SELECT Id, (SELECT Id, StepStatus,Comments FROM Steps)FROM ProcessInstance  WHERE Status='Approved' and  TargetObjectId=:opp1.id limit 1];

 

opp1.comments = p.comments; 

 

//This is not working

 

i want to get the comments from the Query to custom field

 

}

 

any ideas please!!

 

Hi
I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object
When i Scheduled it i am facing a New Error and my Job is Failing
The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"
any Ideas on this Error and to rectify it !
Scheduled Batch Apex Error

Hi
I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object
When i Scheduled it i am facing a New Error and my Job is Failing
The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"
any Ideas on this Error and to rectify it !

 

Hi

 

I have a scheduled Batch Apex class scheduled for 1 Hr Interval to update or insert a Record into a custom Object from other Object

 

When i Scheduled it i am facing a New Error and my Job is Failing

 

The Error is "First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation"

 

any Ideas on this Error and to rectify it !

Ok,

 

So I've been using a controller to do a bunch of math functions on Inputfields on my page. The response of the page has degraded quite a bit so I decided to move my math functions to jquery.

 

So I'm starting with my simpliest formula where I have an inputfield for Unit Quantity, Unit Price, and Total Amount Paid.  So I created this function:

 

<script type="text/javascript">
	$j = jQuery.noConflict();
	function jsCalculate(){
		var UQ = document.getElementById('{!$Component.page.theform.ContractProductsBlock.pbs.pbsiUQ.InputUQ}').value;
		var UP = document.getElementById('{!$Component.page.theform.ContractProductsBlock.pbs.pbsiUP.InputUP}').value;
		var P = UQ * UP;
		document.getElementById('{!$Component.page.theform.ContractProductsBlock.pbs.pbsiTAP.InputTAP}').value = P;
}
</script>

 

So Here's what I'm having issues with. If I set the InputTAP value to UQ or to UP i get the correct number when the function is called. However when I try to assign it to P or do the math directly in the value set (InputTtap.value = UQ * UP)

I get an "NaN" error message instead of the product.

What am I doing wrong here? The function is being called and I'm getting the right values from my input fields but the math portion seems to fail.

 

 

I have a Visualforce page which uses standard controller and controller Extensions, I want to dispaly a Custom Validation Error message on the VF page. Any ideas!

Hi,

 

I have a Visual force page and a command button when clicked would load another Visualforce page.

Can we load that new visualforce page on button click in a new window?

 

I have a roadblock to get that done. Any help is great.

 

Thanks,

Sales4ce

Hi.

I make some calculations in javascript, becouse it's faster as waiting for response from server.

wenn I change content of inputText, it comes no even onChange and the setter of Variable will not called.

 

Here is the code:

<script>
var gesMen;
</script>
    <script>
function calcPrice(elem){
    var path = elem.id.split(":");
    var root = elem.id.replace(path[path.length-1],"");
    gesMen = 10;
    document.getElementById(root+"anzVerp").value = gesMen;
    return null;
}

</script>

 

<apex:column headerValue="Anzahl Verpackungen">
    <apex:actionregion immediate="True">
        <apex:inputText value="{!anzVerp}"
            disabled="true" id="anzVerp">
            <apex:actionsupport event="onchange" />
            <apex:param name="Position" value="{!AP.lfdNr}" assignTo="{!applylfdNr}" />
        </apex:inputText>
    </apex:actionregion>
</apex:column>

 

Thanks

  • March 11, 2011
  • Like
  • 0

 

hi 
i got the similar problem to break a PDF page , i have a quote with line items table, when the line items are more the table automatically going to second page but its is overlapping with the header on the second page , i want the table to be continued after the header ,

 

 the following is my vf code:

 

 

<apex:page Controller="MyController32" RenderAs="pdf" >
<html>
<head>
<style type="text/css" media="print">

@media print
{
table {page-break-inside:auto }
 tr    { page-break-inside:avoid; page-break-after:auto }
 
 thead { display:table-header-group }
}
 
@page {

@PageBreak{
page-break:always;
page-break-inside:avoid;
} 

size:landscape;

@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
@top-center {

content: element(header);

}

@bottom-center {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 1px;

position: running(footer);

}

 




</style>

</head>

<!--header-->
<div class="header">
<table border='0'>
<tr>
<td height = '100'>
<apex:image id="theImage" value="{!$Resource.harlanlogo}" width="136" height="65"/>
</td>
</div>

<!--table-->
<body>
<div>
<table border ='1'>
<thead>
<tr>
<th>Number</th>
<th>M/F</th>
<th>Product</th>
<th>Description</th>
<th>Purpose</th>
<th>Item Price </th>
<th>Final Price </th>
<th>Packing Costs</th>
<th>Freight Costs </th>
<th>Total Costs</th>
</tr>

</thead>
<tbody>

<tr>
      <apex:repeat value="{!Quoteproduct}" var="a">
      
     
     
<tr style="page-break-after:auto;">

<td>{!FLOOR(a.Quantity__c)}</td>
<td>{!a.Sex__c}</td>
<td>{!a.Product__r.Description}</td>
<td>{!a.Product__r.Name } {!a.Age_Weight__c }</td>
<td>{!a.Purpose__c}</td>
<td>{!IF((a.Product__r.Family =='Package'||a.Product__r.Family=='Freight'),0,a.Sales_Price__c)} </td>
<td>{!IF((a.Product__r.Family =='Package'||a.Product__r.Family=='Freight'), 0 ,a.Discounted_Price__c)} </td>
<td>{!IF((a.Product__r.Family =='Package'),a.Sales_Price__c,0)}</td>
<td>{!IF((a.Product__r.Family =='Freight'),a.Sales_Price__c,0)} </td>
<td>€ {!a.Total_Price_QP__c}</td>
</tr>

      
</apex:repeat>
</tr>
</tbody>
</table>
</div>









</body>

</html>
</apex:page>