• Raj Dharsandia
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I have below for loop inside one apex method and here records i am passing as 3000 then it is hitting the heap limit and my code is not working as expected 

for(Integer i=0;i<recordsCount;i++){                
                Purchase_Request_Line_Item__c purchaseRequestLineItem = newPurchaseRequestLineItem.clone(false,true);
                String uniqueId= getUniqueId();
                Inventory_Item__c inventoryItemRecordReference = new Inventory_Item__c(PRLIExtID__c=uniqueId);
                purchaseRequestLineItem.Inventory_Item__r =inventoryItemRecordReference;
                SObject inventoryItemRecord = childObjRecord.clone(false, true);
                inventoryItemRecord.put('Name',inventoryItemRecord.get('Name')+'-'+String.valueOf(i)+' '+date.today().format());
                inventoryItemRecord.put('PRLIExtID__c',uniqueId);
                recordsToInsertInInventoryItem.add(inventoryItemRecord);
                recordsToInsertInPurchaseLine.add(purchaseRequestLineItem);
                if (math.mod(i, 1000) == 0) {
                    system.debug('Inside for: Heap size is ' + limits.getHeapSize() + ' enforced is ' + limits.getLimitHeapSize());
                }
            }
Hi,

I Want to scroll to top of the page to indicate that error has occured. When i am try to display the error message page is not scrolling to top when error is occured.i want to auto scroll top when error occured in lightning component.Please help me its urgent.