• raghu ram 114
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hello,
I would like to create a custom action to download record attachments as a zip in LightningExperience.
I created a controller and Visualforce to download attachments obtained using zippex https://github.com/pdalcol/Zippex.
public class ImageZipController {
    
  public final ParentObject__c parent {get; set;}
  private Id parentObjId;
    
  public ImageZipController(ApexPages.StandardController stdController) {
      this.order = (order__c)stdController.getRecord();
  }
  
    public PageReference downloadAttachments(){
	orderId = order.Id;

    String objectId = parentObjId;
    String docName =  'test.zip'; 
    List<Attachment> attachments = [SELECT Name, Body FROM Attachment WHERE ParentId = :objectId];
    System.debug('>>> attachments ' + attachments.size());
    Zippex sampleZip = new Zippex();
    for(Attachment file : attachments) {
      sampleZip.addFile('folder/' + file.Name, file.Body, null);
    }
    try{
      Document doc = new Document();
      doc.FolderId = UserInfo.getUserId();
      doc.Name = docName;
      doc.Body = sampleZip.getZipArchive();
      insert doc;
      System.debug('>>> doc ' + doc.Id);
      return new PageReference('/servlet/servlet.FileDownload?file=' + doc.Id);
    } catch ( Exception ex ) {
      System.debug('>>> ERROR ' + ex);
    }
    return null;
  }

}

But even small files will give errors.
Error: System.LimitException: Apex CPU time limit exceeded

I researched myself and found that using @future can avoid it, but I don't know what code to write.
I do not have enough knowledge as a developer.
Please Help me.

Hi,

 

I do have a doubt regarding Salesforce.com.

 

Can we develope Games in the Salesforce.com platform?

  • August 07, 2013
  • Like
  • 0

I have been working on the Force.com for some time now and one thing that really helps me learn the platform is pushing the envelope and seeing where it tears. To this end I have decided to build a game on it.

Not anything fancy, like a first person shooter, just a turn based strategy game, like Risk.

Or more accurately, like Outreach.

Most of those old board games were little more than databases anyway, so I figured this would be an easy project. In fact the hardest part I anticipated was creating a hex map in CSS, but that turned out to be a two hour chore.

Ergo i anticipate smooth sailing from here on out. I am posting this here for anyone interested in following my progress as i take the Force.com platform that, to the best of my knowledge, it hasn't gone before, and also for anyone interested in helping me beta test the game when I am done.

 

Ciao.