A blog about Salesforce CRM Configuration and development

Saturday, 23 June 2018

Generate DataMatrix code in Salesforce

The Data Matrix is a two-dimensional barcode consisting of black and white "cells" or modules arranged in either a square or rectangular pattern, also known as a matrix. The information to be encoded can be text or numeric data.

To generate DataMatrix code in Salesforce for object records fields, I am going to use this website (https://barcode.tec-it.com/) which provided all kinds of barcode generation url.

Below are steps to generate DataMatrix code.

Create a custom formula field on the Object.






















IMAGE('https://barcode.tec-it.com/barcode.ashx?data='+ Name + '&code=DataMatrix&multiplebarcodes=false&translate-esc=false&unit=Fit&dpi=96&imagetype=Gif&rotation=0&color=%23000000&bgcolor=%23ffffff&qunit=Mm&quiet=0&dmsize=Default', 'DataMatrix Code')

The generated DataMatrix code will show on Account record detail page.




















Now, show this DataMatrix code on the Visualforce page (Render page as PDF).

<apex:page standardController="Account" renderAs="pdf"  docType="html-5.0">
 <apex:form >
     <apex:outputText value="{!account.DataMatrix_Code__c}" escape="false" style="float:right;"/><br/><br/>
      Name: &nbsp; <apex:outputText value="{!account.Name}"/><br/>
      Email: &nbsp; <apex:outputtext value="{!account.AccountNumber}" />
 </apex:form>
</apex:page>

Output: As you can see DataMatrix code is not showing properly on PDF page.




















To make this DataMatrix code render properly on PDF page We need to add this URL ( https://barcode.tec-it.com ) to a remote site setting.






Share:

2 comments:

  1. It's so nice article thank you for sharing a valuable content. google cloud online course

    ReplyDelete
  2. This is an awesome post. Really very informative and creative writing about barcode. This concept is a good way to know the facts about barcode more. I like it and help me to develop my ideas very well. Thank you for this explanation and nice information. Buy Cheap Ean Barcode

    ReplyDelete

Trailhead Profile


Follow by Email

Total Pageviews

Followers

Popular Posts

Powered by Blogger.

Contact form

Name

Email *

Message *