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 blobs into single Blob
to insert this content into attachment.
But while I am trying to add all three blobs into single blob, It is showing following error.
Even I gone through answer. But result comes without success.
Arithmetic expressions must use numeric arguments
Here is the class:
@RestResource(urlMapping='/stringoncase/*')
global with sharing class RESTCaseController {
@HttpPost
global static String createNewCase(String Casenumber,String filename,String content1,String content2,String content3) {
Case ca = [Select id,status,Origin from case where casenumber=:Casenumber];
//ca.Status = status;
//ca.Origin = web;
//insert ca;
blob base1 = EncodingUtil.base64Decode(content1);
blob base2 = EncodingUtil.base64Decode(content2);
blob base3 = EncodingUtil.base64Decode(content3);
Attachment attachment = new Attachment();
attachment.Body = Blob.valueOf(base1.toString() + base2.toString() + base3.toString());
attachment.Name = filename;
attachment.ParentId = ca.id;
attachment.ContentType='multipart/form-data';//'application/json';
insert attachment;
return 'sucess';
}
}
I provide the input to the class using postman like the following
{
"Casenumber" :"00001060",
"filename" : "5_MBfiel.pdf",
"content1" : "------Encoded data------",
"content2" : "",
"content3" : ""
}
How could I add these three blobs into single Blob?