Skip to main content

Posts

Showing posts from August, 2018

Processing MultiPart/Form-Data file/Attachment using HTTP in Apex

If you need to process a file like images to some third party system using HTTP request in Apex , we need the Multipart/Form-data processing in the HTTP request. In this example I am using salesforce chatter Rest API to fetch the content of a file and then passing that file content to the HTTP request. This is just a sample code , you will have to enter the authorization tokens and endpoints. Please note that processing files /Attachments using this may cause heap size governor limit also it counts against your daily limit of outbound webservice (HTTP) calls.  1.Fetch File Content From Salesforce  Blob bodyBlob = null;  HTTPRequest req = new HTTPRequest();  req.setEndpoint('<YourInstance>/services/data/v43.0/connect/files/ fileId /content');  req.setMethod('GET');  req.setHeader('Authorization', 'Bearer  <Set oAuth Token>');  Http http = new Http();  HTTPResponse res = http.send(req);  bodyBlob = blob.valueO...

Salesforce Live Agent to your Service Console - Prechat Vs Custom Attributes

If are working on a Live Agent implementation for your client , you might come across certain circumstances where you will have to decide between using a Pre-chat form or embedding the custom attributes to get the parameters from the web-server or Portal it is deployed. PreChat  If your requirements has Pre-chat form then your life becomes easy , since Pre-chat form can be hosted on Salesforce VF page and it gives you more control over find or search record in salesforce , linking a record to another or automatically invoking the knowledge widget of Service Console based on the customer's problem description entered at pre-chat. Before using pre-chat , you will have to do some basic configurations like creating Buttons , deployment , setting up a chat user etc. Please follow the Salesforce Live Agent guide for configuring the same. A sample Pre-Chat form will like this. <apex:page showHeader="false">            ...