Import CSV file data using Apex & VF page

Here is the sample example how to import csv file data into salesforce. VF Page: <apex:page sidebar="false" controller="ImportCSVFile"> <apex:form > <apex:sectionHeader title="Upload CSV data File"/> <apex:pageBlock > <center> <apex:inputFile value="{!FileContent}" filename="{!Filename}" /> <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/> <br/> <br/> <font color="red"> <b>Note: Please use the standard template to upload Accounts.</b> </font> </center> <apex:pageblocktable value="{!uploadedAccounts}" …

Continue reading Import CSV file data using Apex & VF page

Advertisements

Upload the file from external system into salesforce

This is sample example how to fetch one file in google system (example: Live Agent guide) Url: https://resources.docs.salesforce.com/sfdc/pdf/live_agent_dev_guide.pdf and uploading as a attachment into contact record in salesforce. Apex Class: Public class UploadFileintoSalesforce{ public static blob fetchfile(String fileurl){ Http h = new Http(); HttpRequest req = new HttpRequest(); fileurl = fileurl.replace(' ', '%20'); //Set the end point URL req.setEndpoint(fileurl); req.setMethod('GET'); req.setHeader('Content-Type', 'application/pdf'); req.setCompressed(true); req.setTimeout(60000); HttpResponse res  = h.send(req); system.debug('Response  ' + res.getBody()); blob Fileret = res.getBodyAsBlob(); return Fileret; } public static Id createAttachment(blob fileContent, String recordId, String fileType){ //for pdf files content type should be pdf //for jpeg file content type should be image/jpeg Attachment attach = new Attachment(); attach.ParentId = recordId; attach.Name = 'FileAttached.pdf'; attach.Body = fileContent; attach.contentType = fileType; insert attach; …

Continue reading Upload the file from external system into salesforce

Translating Language in VF page

  Here in this post , explaining a sample VF page, how to translate field values into different languages in salesforce on contact object. Lets first understand about SelectOption SelectOption Class A SelectOption object specifies one of the possible values for a Visualforce selectCheckboxes, selectList, or selectRadio component. Namespace System SelectOption consists of a label that is displayed to the end user, …

Continue reading Translating Language in VF page

Sample Progress Indicator Lightning Component(Loan Process Example)

Here in this post i am sharing how to create a lightning component to show progress indicator for loan process(Anything we can use for case status/Opportunity stage etc.,) Create a Lightning Component (LoanProcess): LoanProcessController.js: ({ handleNext : function(component,event,helper){ var getselectedStep = component.get("v.selectedStep"); if(getselectedStep == "LoanInfo"){ component.set("v.selectedStep", "BasicInfo"); } else if(getselectedStep == "BasicInfo"){ component.set("v.selectedStep", "ResidenceInfo"); } …

Continue reading Sample Progress Indicator Lightning Component(Loan Process Example)

What are the Components Available /Not Available in Salesforce Change sets.

Here in this post i am giving list of components available  and Non- available to add in Change sets. Available components: The following types of components can be added to a change set. Action Action Link Group Template Apex Class Apex Sharing Reason Apex Trigger App Approval Process Asset File Assignment Rule Auth. Provider Auto-Response Rule …

Continue reading What are the Components Available /Not Available in Salesforce Change sets.

Salesforce Triggers Order of Execution

Salesforce Apex can be invoked by triggers, which enables you to perform or take any of the custom or pre-defined action when any changes occur in the Salesforce records. These operations can be insertion, deletion or updating of any record. Therefore the Apex triggers can be of the following types: Before Triggers: They are used …

Continue reading Salesforce Triggers Order of Execution

Iterate map values in Salesforce Lightning component

aura:iteration iterates over a collection of items and renders the body of the tag for each item. Data changes in the collection are rerendered automatically on the page. aura:iteration supports iterations containing components that have server-side dependencies or that can be created exclusively on the client-side. Attribute Name Type Description body ComponentDefRef[] Required. Template to use when creating …

Continue reading Iterate map values in Salesforce Lightning component