• Chie Men
  • NEWBIE
  • 40 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies
Hi, 

I have a code that attaches multiple files to a Case but encounter an issue with files that's 200KB and above.


Here's the code that reads multiple files and save it as an attachment to a Case.


for (var i = 0; i < files.length; i++){        
    //console.log('looping  file...' + files[i].file.name);
    (function(file) {
                     
        var reader = new FileReader();                                  
        reader.onload = function (e) {
            console.log('reader.onload ..' + file.name);
            var byte64 = reader.result.replace('data:', '').replace(/^.+,/, '');
            var Attachment = new sforce.SObject("Attachment");    
            Attachment.Name = file.name;                        
            Attachment.ContentType = file.type;
            Attachment.ParentID =  caseId;
            Attachment.Body =  byte64;    
            Attachment.IsPrivate = false;
             
            var insertResult = sforce.connection.create([Attachment]);
            //console.log("insertResult=" +insertResult);
            
        };            
                            
        reader.readAsDataURL(file);    
        
                
    })(files[i].file);     
}


I don't have any issue attaching 1 large file up to 25MB. But when I attached multiple files,  I can only attach up to 200KB. 
For example, I have 2 files.
File A - 186 KB and 
File B - 568 KB. 

There are times,  that I can attach 186KB and 568KB but most of the time, it's only File A that is successfully attached. The code skips File B.  I removed that code that creates the attachment and I notice that the console log -- console.log('reader.onload ..' + file.name); -- is printed. This was not printed when sforce.connection.create([Attachment]); is present.

Any idea on this?
When and how is the Amount Used  column in the Usage-based entitlements updated? I have a Customer Community Plus Login license and I assigned a user to that license. After that, I logged in. I checked the company information page, Customer Community Plus login license is now less than 1. When I checked the Usage-based entitlements, neither the Power Customer Community Daily Unique Logins or Power Customer Community Logins has a value in the Amount Used.
I thought that when I logged in using the user i just created, there will be a value on the Amount used.
Hi.  Based on this link, https://help.salesforce.com/articleView?id=000004637&type=1
Phone and Fax numbers will also be auto populated. But when I created a Contact and associate it with an Account having an address, phone and fax numbers, the Contact's phone and fax numbers are not auto populated. Any thoughts?

Thank you.
Hi, I created a word document but when clicked on SAVE AS, the dafault file extension is .htm. How can I make it to default to .doc?

Thank you.
Hi, I need to do Platform Encryption and Field Audit Trail in some of my Standard and Custom fields. Can I use change set to deploy it another sandbox?

Thanks,
Hi,
I have a "Generate PDF" button in my Asset detail page.  I was able to generate a PDF file but instead of making it as an attachment to the Asset detail page. Here is the code I get online to generate a PDF file:

Blob pageData; //variable to hold binary PDF data.
        if(!Test.isRunningTest()){ // for code coverage        
            pageData = thePage.getContentAsPDF();
        } else {
             pageData = Blob.valueOf('This is a test.');
         }
        
         //create attachment
        Attachment att = new Attachment(
            ParentId=recordId,
            Body=pageData,
            Name= lname + 'Asset_' + DateTime.now().formatLong() + '.pdf'
         ); 
         insert att;

Instead of attaching the pdf file, I want it to open in a new browser tab.

Thank you.
I have read in Field Audit Trail that "Field history copied from the History related list into the FieldHistoryArchive object". When does this happen? Does it depends on the HistoryRetentionPolicy?

Similar question:

I have set the HistoryRetentionPolicy of my Case object to
    <archiveAfterMonths>1</archiveAfterMonths>
    <archiveRetentionYears>5</archiveRetentionYears>
    
In the Case Fields, I enabled Track Old and New values to Case Origin and Case Reason. Then I modified the values of the said fields.

I then queried the FieldHistoryArchive but I did not see these fields. Will I see the modified fields in the FieldHistoryArchive after 1 month as defined in the History Retention Policy?

Thank you.
Hi, I am setting up Field Audit trail for our org. I have created a HistoryRentionPolicy for the Object Case. I also included the said object in the package.xml.
Then I created a zip file containing both the Case.object file and  package.xml file.

How will I deploy this in a developer's sandbox?
 
I found out that  Salesforce Shield is not a full-disc-encryption. Only selected data is stored encrypted at REST in the Salesforce database. I would like to know what fields  or data are guaranteed to be stored encrypted at RES in the db. What happen to those that are encrypted but not selected? It will not be encrypted?
Hi, 

I have a code that attaches multiple files to a Case but encounter an issue with files that's 200KB and above.


Here's the code that reads multiple files and save it as an attachment to a Case.


for (var i = 0; i < files.length; i++){        
    //console.log('looping  file...' + files[i].file.name);
    (function(file) {
                     
        var reader = new FileReader();                                  
        reader.onload = function (e) {
            console.log('reader.onload ..' + file.name);
            var byte64 = reader.result.replace('data:', '').replace(/^.+,/, '');
            var Attachment = new sforce.SObject("Attachment");    
            Attachment.Name = file.name;                        
            Attachment.ContentType = file.type;
            Attachment.ParentID =  caseId;
            Attachment.Body =  byte64;    
            Attachment.IsPrivate = false;
             
            var insertResult = sforce.connection.create([Attachment]);
            //console.log("insertResult=" +insertResult);
            
        };            
                            
        reader.readAsDataURL(file);    
        
                
    })(files[i].file);     
}


I don't have any issue attaching 1 large file up to 25MB. But when I attached multiple files,  I can only attach up to 200KB. 
For example, I have 2 files.
File A - 186 KB and 
File B - 568 KB. 

There are times,  that I can attach 186KB and 568KB but most of the time, it's only File A that is successfully attached. The code skips File B.  I removed that code that creates the attachment and I notice that the console log -- console.log('reader.onload ..' + file.name); -- is printed. This was not printed when sforce.connection.create([Attachment]); is present.

Any idea on this?
Hi.  Based on this link, https://help.salesforce.com/articleView?id=000004637&type=1
Phone and Fax numbers will also be auto populated. But when I created a Contact and associate it with an Account having an address, phone and fax numbers, the Contact's phone and fax numbers are not auto populated. Any thoughts?

Thank you.
Hi, I need to do Platform Encryption and Field Audit Trail in some of my Standard and Custom fields. Can I use change set to deploy it another sandbox?

Thanks,
I have read in Field Audit Trail that "Field history copied from the History related list into the FieldHistoryArchive object". When does this happen? Does it depends on the HistoryRetentionPolicy?

Similar question:

I have set the HistoryRetentionPolicy of my Case object to
    <archiveAfterMonths>1</archiveAfterMonths>
    <archiveRetentionYears>5</archiveRetentionYears>
    
In the Case Fields, I enabled Track Old and New values to Case Origin and Case Reason. Then I modified the values of the said fields.

I then queried the FieldHistoryArchive but I did not see these fields. Will I see the modified fields in the FieldHistoryArchive after 1 month as defined in the History Retention Policy?

Thank you.
I found out that  Salesforce Shield is not a full-disc-encryption. Only selected data is stored encrypted at REST in the Salesforce database. I would like to know what fields  or data are guaranteed to be stored encrypted at RES in the db. What happen to those that are encrypted but not selected? It will not be encrypted?