Questions tagged [blob]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
0
votes
1answer
672 views

getting scientific notation when converting from string to blob to save to csv

I have a long string that I want to save to CSV. I use the following code to convert the string to blob and save as a file: Attachment newFile = new Attachment(); newFile.Name = getReportFileName(); ...
0
votes
1answer
935 views

Arithmetic expressions must use numeric arguments

The following class will get the content(a maximum of 10 MB) in encode format and I convert the content into decode format based on the my requirement into three parts. Now I want to add the all three ...
4
votes
1answer
2k views

How to generate a >5 MB blob for an Apex test class

I am writing a test class for a file uploader thingamajig I wrote. The class takes a blob representing the contents of the file. So far everything is going well and I've got 93% code coverage. ...
0
votes
1answer
59 views

HttpRequest Converting > to?

I am using code (see below) that I found for sending an AWS SES message with an HttpRequest to amazon. I am able to send MIME messages with PDF attachments and all has been great. Today, I tried ...
0
votes
1answer
2k views

How to write test class on Blob method

I have a PageReference method as given below I am trying to write a test class for this it shows error. Error Message: System.NullPointerException: Argument cannot be null. Stack Trace: ...
3
votes
4answers
15k views

Send Blob file via Apex Rest Callout

I'm trying to send a Blob Apex REST callout and it is keep failing. I tried all the examples in the web but didn't work. What is the standard and correct way to send Blob data via REST callouts? //...
0
votes
2answers
12k views

Save base64 data as Attachment

This has been bugging me for a while. I think I am missing something very obvious. So from a REST api I am getting a base64 data of a PDF. I am trying to save the PDF as Attachment under an object. I ...
1
vote
1answer
2k views

Trying to show the content field (blob) from contentNote in Visualforce

Trying to show the content field (blob) from contentNote in Visualforce. All that shows is "core.filemanager.ByteBlobValue@225c5e8c". I realize that I must somehow change the blob to text, but I ...
0
votes
2answers
48 views

How to view attachment content?

I would like to see the Attachment body in plain string, but cannot find out how. For ex: Attachment a = [SELECT Id, Name, Body, ContentType, ParentId FROM Attachment WHERE ParentId = '...
1
vote
1answer
39 views

Comparing Message Authentication Codes in Apex

I'm trying to incorporate message authentication into an application I'm working on. Ideally, I need to verify that the MAC generated by the requester matches the recomputed MAC on the server side. ...
0
votes
0answers
718 views

Resource image in to Blob for attachment

I have a trigger method after update on Opportunity. I am trying to insert attachment after closing the opp. private void createOppAttachments(list<Opportunity> opps) { Set<Id> ...
2
votes
1answer
482 views

How do I convert a Blob into an alphanumeric string and back?

There's a Blob I generated by encrypting a certain string: Blob data = Blob.valueOf('my string'); Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data); Is there a way to ...
0
votes
2answers
830 views

Continuation pattern and JavaScript Remoting - corrupted file in the response

My current solution is working with following logic: system is calling remote action from vf page in the method there is a HttpRequest, system is calling external system, is sending file which will ...
1
vote
2answers
741 views

Is Document Body Blob field value encoded in Base64 when extracted by Dataloader? Can this encoding be used for insert or update?

I want to use Salesforce DataLoader to extract and upload Documents. However, I don't understand in which format Blob Body values are stored, is it Base64 encoded? Looks like yes, but why it is not ...
1
vote
0answers
36 views

getContent Issue on Scheduled Apex [duplicate]

Recently, I've been developing a scheduled apex class to send a csv file to an email. I was using the getContent method from a report page to achieve this. I was doing fine when executing it in ...
0
votes
1answer
280 views

Making the content in response as attachment

In one of the apex call in bound call I am receiving an xml with content in string format as part of the response. Can I store the content in the reqas a txt/xml file in the attachment of a custom ...
0
votes
1answer
3k views

Merging pdf attachments

I am trying to merge pdf attachments and sending it as email. I am able to merge them but the last pdf always get overwrite all the others and send email as one. When I checked my email attachment ...
2
votes
0answers
587 views

Not Able to Authenticate To Azure Blob Storage

I am trying to get blob from Microsoft Azure Blob Storage. But like everytime I am receiving same error. System.HttpResponse[Status=Server failed to authenticate the request. Make sure the value of ...
1
vote
1answer
3k views

Getting the Error : Failed to load PDF Document on attachment preview

I have created a Visualforce page using Jquery , I am uploading PDF file . However, Onafter successful uploading it is given me Error --- Failed to load PDF Document The VF Page involved is : <...
9
votes
2answers
8k views

How to combine multiple Blob in apex to get single Blob value

Is there a way in Apex to combine multiple Blob values and get a single Blob value? Blob b1 = Blob.valueOf('s1'); Blob b2 = Blob.valueOf('s2'); Blob b3 = Blob.valueOf('s3'); Blob combined = b1 + b2 + ...
1
vote
1answer
5k views

visualforce to create a attachment for an object

I have an object - test_Object2__c for which i am creating a VF page. What I am trying to do is get an input from user for attachment and insert that attachment in notes and attachment related list of ...
0
votes
2answers
388 views

Trying to upload attachment blob to Egnyte REST API

I am having an issue specifically trying to upload an attachment blob to Egnyte using the REST API. Code is below. Any input is appreciated, I am guessing my POST is missing something but I can't see ...
0
votes
1answer
1k views

Passing a bigger file from VF to Apex Controller

I created a page that passes a file from the VF to the Controller. It's working fine, except when the file is bigger I hit the blob limit in the controller. What I do: On the front end I convert the ...
0
votes
1answer
174 views

List out of bound exception at List<Blob>

I have below piece of code where I get below error. Here b is the List of blobs. Error List index out of bounds: 3 Apex Code for(integer i = 0; i <counter; i++) { Messaging....
0
votes
1answer
124 views

Null Pointer exception to add blob to list of blob

I have below piece of code where I am getting a Null pointer exception adding blob to a list of blobs. Can someone let me know my mistake please? Apex code counter=1; form = integer.valueof(...
0
votes
1answer
132 views

Multiple blob creation for creating multiple PDFs

I have below piece of code to generate a PDF file. I have a requirement to create multiple blobs for multiple PDFs. I am trying to do so but not working as expected. Apex code PageReference pageRef =...
10
votes
1answer
8k views

Why is String.valueOf(Blob) different that Blob.toString()?

I am working on a REST Service that will desiralize the request body and interpret it. My understanding was that calling String.valueOf(objectInstance) would just call objectInstance.toString(). ...
2
votes
2answers
2k views

Alternative to renderas PDF for converting an HTML to PDF in apex

Is there any alternative or work around to HTML to PDF convert in apex? Please help and provide your suggestions.
0
votes
1answer
76 views

how to declare a Class for Attachment on a Case Object

How to Pass Blob file_body and file_Name public void uploadFile(Blob body, String name, String reqEndPoint){ String boundary = 'fddfed232323'; String header = '--'+boundary+'\r\...
2
votes
1answer
881 views

Fahrenheit symbol (°F) causing "BLOB is not a valid UTF-8 string" exception

The requirement I'm working on requires to read a CSV file with temperature measurements. But Fahrenheit or Celcius symbols are causing exceptions when converting csv blob file to string using ...
1
vote
1answer
612 views

How to retrieve BLOB content from a case

We use salesforce to create different cases and we can attach the docs to a case as well. Now, i have to retrieve the attached doc from a case using REST API. I have used below query "SELECT Body ...
1
vote
3answers
3k views

Select body Of attachments

In an apex funtion - getAttachments() - i'm requesting some attachments and their body: Set<Id> attIds = new Set<Id>{id1, id2}; List<Attachment> attLst = [Select Name, Body From ...
2
votes
0answers
411 views

Embedding an image in PDF attachment using html tags and Blob.toPdf()

I want to add an image to a pdf I am creating and attach it to an email that I send via apex code. I am using html and Blob.toPdf() to make the pdf. I saw this post regarding Blob.toPdf()'s ...
4
votes
1answer
3k views

Reading a pdf file in apex controller

I am trying to read a pdf file that is stored in Static resources.The body of the pdf comes in a Blob format, but I am not able to get the blob back to the readable format.How do I accomplish it.
2
votes
1answer
4k views

Apex Blob data chunking

I am able to upload the Blob data to the local web server. However, the I have run into the error "Exceeded max size limit of 12000000 with request size xxxxx" This means that the file size is ...
2
votes
2answers
1k views

How to use Blob inside a Trigger (BLOB is not a valid UTF-8 string)?

I am writing a trigger to Insert a Image in a record which will be posted via feed string img; trigger will save if I define "img" has a String on line 3 & ...
4
votes
1answer
5k views

Getting Blob data from content document using File Sync

So im using File Sync to upload an excel file to salesforce in order to use it in other class ive built (the class is reading the csv file and insert the data to salesforce - that one works fine ...
0
votes
0answers
613 views

Corrupted file error after creating Attachment from data(attachment) from Other SalesForce Instance through Rest Api

We are facing issue when we create Attachment record in Apex, using the data that we get from Rest Api from another instance. Tried with Blob.ValueOf(responsebody), EncodingUtil.base64decode(...
2
votes
1answer
2k views

Heap Size Limit: Can we split up Blobs?

Whilst parsing text files using Batch Apex, we retrieved an Heap Size error. The Heap Size limit happens before our custom Iterator. Because we parse an attachment, change it into a Blob and then ...
3
votes
1answer
2k views

dataURL to blob

I'm passing the dataURL from JS in the vfp to the extensions class. I'm trying to store that image as an attachment to the custom object. The attachment is uploaded but when I try to open, a "file" (...
11
votes
2answers
2k views

Save attachment with Remote Objects

is it even possible to save attachment with remote objects to salesforce? I tried this: construct remote object model <apex:remoteObjects jsNamespace="MyModel"> <apex:remoteObjectModel ...
1
vote
1answer
2k views

Send email with excel attachment - Blob variable doesnot exist error

I have a Map. that I built in apex class. I want to put that map output into an excel and send it as attachment. Here's the code that Im using. I get Blob variable doesn't exist error ( in the ...
2
votes
1answer
2k views

How to concatenate two PDF in Apex

Creating a map of Id and Blob in the following for loop from the Page which has renderAs="pdf" for(Account acc : [query]) { PageReference pdf = Page.AccountInvoice; pdf.getParameters().put('...
10
votes
2answers
9k views

Upload an Attachment via the Rest API

I'm having an issue uploading attachments via the REST API. When trying to upload attachment data (i.e. data about the attachment and the associated base64 binary data) I'm getting a 400 result (Bad ...
4
votes
1answer
4k views

Combine multiple PDF's together and attach them in a mail?

As of now , all i have is a VF page which renders as a PDF and it needs Account ID to be passed to generate a PDF . Is there a way wherein i can group all the PDF's into a single PDF ? Should i change ...
2
votes
1answer
558 views

Equivalent data type in standard or custom object to persists blob data?

I have built a webservice in salesforce so that it is being consumed from SAP. So, when a sales order is created in SAP, it would call the salesforce webservice and post the sales order details and ...
1
vote
0answers
329 views

Decode Signature

I've one signature field containing encoded values like 'iVBORw0KGgoAAAANSUhEUgAAApAAAACNCAYAAAAAYko8AAAAHGlET1QAAAACAAAAAA...' and i want to restore it back and put them into a list and display the ...
1
vote
1answer
7k views

JSON Deserialize Byte Array

I'm porting over a rest client from .NET to Apex and in the class that gets initiated by deserializing the JSON response, there is a byte[]. C# Example: public class MyResponse { public ...
3
votes
1answer
2k views

Blob store the data in binary form or in base64

1) When we upload a file into the document object then is the body of the document in binary form or in base64 form? 2) If I uploaded two files in document, First is abc.txt and second is xyz.pdf ...
3
votes
2answers
3k views

File Attachment not working when attaching crm Content

I have a page where the user selects content (that is 5MB or lower, only 2 attachments allowed per email) to use as an attachment in an email. It all seems to work fine, the email sends and there are ...