• Kyle Brandt
  • NEWBIE
  • 30 Points
  • Member since 2016

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

Is it possible to hide and unhide (make collasable) a horizontal portion of a table?  For example say I had the following in a data table
time series data - forecast on time series data - percent growth on time series data

and I wanted to make it possible to hide an unhide sections.

Thanks,
I want to add a button to my opportunity header record that is called Insert Products. This will send the opportunity ID to a visualforce page which will have a select file button and an insert button that will loop through the CSV and insert the records to the related opportunity.

This is for non technical users so using Data loader is not an option.

I got this working using standard apex class however hit a limit when i load over 1,000 records (which would happen regularly).

I need to convert this to a batch process however am not sure how to do this.

Any one able to point me in the right direction? I understand a batch should have a start, execute and finish. However i am not sure where i should split the csv and where to read and load?

I found this link which i could not work out how to translate into my requirements:http://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

Here is the code i have for the standard apex class which works.
 
public class importOppLinesController {
public List<OpportunityLineItem> oLiObj {get;set;}
public String recOppId {
        get;
        // *** setter is NOT being called ***
        set {
            recOppId = value;
            System.debug('valuevalue);
        }
    }
public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}

public List<OpportunityLineItem> oppLine{get;set;}
  public importOppLinesController(){
    csvFileLines = new String[]{};
    oppLine = New List<OpportunityLineItem>();
  }
  public void importCSVFile(){

       PricebookEntry pbeId;
       String unitPrice = '';

       try{
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n
           for(Integer i=1;i<csvFileLines.size();i++){
               OpportunityLineItem oLiObj = new OpportunityLineItem() ;
               string[] csvRecordData = csvFileLines[i].split(',');

               String pbeCode = csvRecordData[0];
                pbeId = [SELECT Id FROM PricebookEntry WHERE ProductCode = :pbeCode AND Pricebook2Id = 'xxxx HardCodedValue xxxx'][0];                  

                oLiObj.PricebookEntryId = pbeId.Id;

               oLiObj.Quantity = Decimal.valueOf(csvRecordData[1]) ;
               unitPrice = String.valueOf(csvRecordData[2]);
               oLiObj.UnitPrice =  Decimal.valueOf(unitPrice);

               oLiObj.OpportunityId = 'recOppId';;
               insert (oLiObj);
           }
        }
        catch (Exception e)
        {

             ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, e + ' - ' + unitPrice);

            ApexPages.addMessage(errorMessage);
        }
  }
}

 
I want to add a button to my opportunity header record that is called Insert Products. This will send the opportunity ID to a visualforce page which will have a select file button and an insert button that will loop through the CSV and insert the records to the related opportunity.

This is for non technical users so using Data loader is not an option.

I got this working using standard apex class however hit a limit when i load over 1,000 records (which would happen regularly).

I need to convert this to a batch process however am not sure how to do this.

Any one able to point me in the right direction? I understand a batch should have a start, execute and finish. However i am not sure where i should split the csv and where to read and load?

I found this link which i could not work out how to translate into my requirements:http://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

Here is the code i have for the standard apex class which works.
 
public class importOppLinesController {
public List<OpportunityLineItem> oLiObj {get;set;}
public String recOppId {
        get;
        // *** setter is NOT being called ***
        set {
            recOppId = value;
            System.debug('valuevalue);
        }
    }
public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}

public List<OpportunityLineItem> oppLine{get;set;}
  public importOppLinesController(){
    csvFileLines = new String[]{};
    oppLine = New List<OpportunityLineItem>();
  }
  public void importCSVFile(){

       PricebookEntry pbeId;
       String unitPrice = '';

       try{
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n
           for(Integer i=1;i<csvFileLines.size();i++){
               OpportunityLineItem oLiObj = new OpportunityLineItem() ;
               string[] csvRecordData = csvFileLines[i].split(',');

               String pbeCode = csvRecordData[0];
                pbeId = [SELECT Id FROM PricebookEntry WHERE ProductCode = :pbeCode AND Pricebook2Id = 'xxxx HardCodedValue xxxx'][0];                  

                oLiObj.PricebookEntryId = pbeId.Id;

               oLiObj.Quantity = Decimal.valueOf(csvRecordData[1]) ;
               unitPrice = String.valueOf(csvRecordData[2]);
               oLiObj.UnitPrice =  Decimal.valueOf(unitPrice);

               oLiObj.OpportunityId = 'recOppId';;
               insert (oLiObj);
           }
        }
        catch (Exception e)
        {

             ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, e + ' - ' + unitPrice);

            ApexPages.addMessage(errorMessage);
        }
  }
}

 
Hey,

I am trying to find a way to access information on all profiles in one place, extracting this using MetaData API would be ideal as i could just pull the information out of the XML. 

I want to view FLS, Page Layout Assignments for everything so i can do a big overhaul on the security in the org, anyone know how i can do this? I have not managed to be successful from using the MetaData API and ASP.NET.
Hi,

Is it possible to hide and unhide (make collasable) a horizontal portion of a table?  For example say I had the following in a data table
time series data - forecast on time series data - percent growth on time series data

and I wanted to make it possible to hide an unhide sections.

Thanks,
Hello, so i got a VFP thats gonna work as a cover page and needs to have a full page background so it can be embedded on another pages, but i cant seem to get it fullpage, i have tried a lot and cant really find good information about pdf rendering, any help is much appreciated
/*bodyportada.css*/
body{
		margin:0;
		padding:0;
		background-image:url(bigoportada.jpg);
		background-repeat: no-repeat;
	}
<apex:page showHeader="false" applyHtmlTag="false" renderAs="pdf">
 <apex:stylesheet value="{!URLFOR($Resource.estilospdf, 'bodyportada.css')}"/>   
    <body>

    </body>
</apex:page>
When rendered i get white margins
Hi,

We have Visual force Page for Accounts. We have also created a history related list on it. 
<apex:pageBlock title=" History" id="Account_History">
      <apex:pageBlockTable value="{!acchistlist}" var="accounthistory" rows="1000">
         <apex:column value="{!accounthistory.createddate}"/>
         <apex:column value="{!accounthistory.createdby.name}"/>
         <apex:column value="{!accountHistory.field}"/>
         <apex:column value="{!accounthistory.oldvalue}"/>
         <apex:column value="{!accounthistory.newvalue}"/>
      </apex:pageBlockTable>

This is the query
SELECT CreatedById,CreatedDate,CreatedBy.name,Field,NewValue,OldValue FROM AccountHistory

but when I update Account owner, I get 2 rows--> 1 with user id and other with user name
User-added image

How can I get rid of 2nd row i.e. I dont want to see ID row on the history.

Thanks so much for help!


 
I want to add a button to my opportunity header record that is called Insert Products. This will send the opportunity ID to a visualforce page which will have a select file button and an insert button that will loop through the CSV and insert the records to the related opportunity.

This is for non technical users so using Data loader is not an option.

I got this working using standard apex class however hit a limit when i load over 1,000 records (which would happen regularly).

I need to convert this to a batch process however am not sure how to do this.

Any one able to point me in the right direction? I understand a batch should have a start, execute and finish. However i am not sure where i should split the csv and where to read and load?

I found this link which i could not work out how to translate into my requirements:http://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

Here is the code i have for the standard apex class which works.
 
public class importOppLinesController {
public List<OpportunityLineItem> oLiObj {get;set;}
public String recOppId {
        get;
        // *** setter is NOT being called ***
        set {
            recOppId = value;
            System.debug('valuevalue);
        }
    }
public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}

public List<OpportunityLineItem> oppLine{get;set;}
  public importOppLinesController(){
    csvFileLines = new String[]{};
    oppLine = New List<OpportunityLineItem>();
  }
  public void importCSVFile(){

       PricebookEntry pbeId;
       String unitPrice = '';

       try{
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n
           for(Integer i=1;i<csvFileLines.size();i++){
               OpportunityLineItem oLiObj = new OpportunityLineItem() ;
               string[] csvRecordData = csvFileLines[i].split(',');

               String pbeCode = csvRecordData[0];
                pbeId = [SELECT Id FROM PricebookEntry WHERE ProductCode = :pbeCode AND Pricebook2Id = 'xxxx HardCodedValue xxxx'][0];                  

                oLiObj.PricebookEntryId = pbeId.Id;

               oLiObj.Quantity = Decimal.valueOf(csvRecordData[1]) ;
               unitPrice = String.valueOf(csvRecordData[2]);
               oLiObj.UnitPrice =  Decimal.valueOf(unitPrice);

               oLiObj.OpportunityId = 'recOppId';;
               insert (oLiObj);
           }
        }
        catch (Exception e)
        {

             ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, e + ' - ' + unitPrice);

            ApexPages.addMessage(errorMessage);
        }
  }
}