• Abu Zafar Wahid
  • NEWBIE
  • 10 Points
  • Member since 2016
  • 1984


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
Hi everyone,

I'm trying to render multiple dynamic forms, which have different record types. In my lightning component helper class, I have a method where I defined different parameteres and set in the component list type attribute.

My first problem is, I need the dynamic record type Id for the lightning:recordEditForm where I need to set the record type Id. I called the helper method which can pull the record type Id from the server side Apex controller. In this helper method class, I tried to return the record type Id and tried to set the value as below:
var introLaws = [];
introLaws.push({
                    "key"                    : "DummyKey",
                    "recordType"        : this.getRecordTypeId("Dummy Record Type Name")
});
component.set("v.lawsSections", introLaws);
I checked the console log, the record type id is good, but whenver I tried use the record type id in component loop, I found that the recordType is empty. The key value is okay. Please advise.

The second problem is, in the component I have a aura:iteration loop to render the dynamic form, and it should be as below:
<aura:iteration items="{!v.lawsSections}" var="lawsSection">
<lightning:recordEditForm aura:id="{!lawsSection.key}" recordTypeId="{!lawsSection.recordType}" objectApiName="Dummy_Object__c">
And here is the issue. I can't assign the recordTypeId, please advise.

My third problem is, I need to assign the dynamic aura:id to save the form, so that I can just use the below structure
var localId = event.getSource().getLocalId();
var notificationApp = component.find(localId);
Please advise.

I appreciate your time.

Kind Regards,
Abu Wahid
Hi everyone,

Recentetly I've added a form page where user can add much as rows as he wants. All of the input fields keep the previous row data in the form except the checkbox.

FYI, the checkbox does not belong to any standard or custom object, it is just a checkpoint for checking if certain input field checked or not.

I tried to declare the checkbox as List<Boolean> but same issue. Please advise.

Thanks
Hi, 
I have implemented a visualforce page to upload a CSV file and batch apex that reads the CSV and loads data into multiple related custom objects. Now visualforce page allows me to load CSV upto 10 MB but when I try to parse this huge file in apex I run into heap size governor limits.

I have implemented the parsing of CSV file in batch apex exactly as per financialforce customization from below link:
https://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

The post mentions:
You can create a batch process to read the file in chunks and define the number of lines to read for each chunk.
To do this, create a batch apex process where the scope size defines the number of records to read for each chunk. In the sample code that follows, lines from a CSV file are to be read rather than records. The start method returns an Iterable<String> that contains the lines to be processed in the execute method. Afterwards, the process reads the list of lines using the CSVReader in the same way as an online process.
 
global with sharing class ReadAndPopulateBatch implements Database.batchable<String>, Database.Stateful
{
   private String m_csvFile;
   private Integer m_startRow;
   private CSVParser m_parser;
   private static final Integer SCOPE_SIZE = 100;
   public ReadAndPopulateBatch(){....}
   public static ID run(){....}
   global Iterable<String> start(Database.batchableContext batchableContext)
   { 
       return new CSVIterator(m_csvFile, m_parser.crlf);
   }
   global void execute(Database.BatchableContext batchableContext, List<String> scope)  
   {
       //TODO: Create a map with the column name and the position.
       String csvFile = '';
       for(String row : scope)
       {
          csvFile += row + m_parser.crlf;
       }
       List<List<String>> csvLines = CSVReader.readCSVFile(csvFile,m_parser);
       //TODO: csvLines contains a List with the values of the CSV file.
       //These information will be used to create a custom object to
       //process it.
   }
   global void finish(Database.BatchableContext batchableContext){......}
}
Although this post recommends to read the file in chunks it doesnt explain how to do so. It defines a variable private static final Integer SCOPE_SIZE = 100; but doesnt really use it in the example provided.

The input my batch class constructor gets is a BLOB of size 10 MB. How do I read this file in chunks in my apex class so that the user doesnt have to split the file for the data load to work?

Any advice will be really helpful. Thanks!
 
Hi everyone,

Recentetly I've added a form page where user can add much as rows as he wants. All of the input fields keep the previous row data in the form except the checkbox.

FYI, the checkbox does not belong to any standard or custom object, it is just a checkpoint for checking if certain input field checked or not.

I tried to declare the checkbox as List<Boolean> but same issue. Please advise.

Thanks