Thursday, 21 February 2013

Salesforce and QR server integration for QR code generation in Salesforce

QR codes are very helpful in emails or business cards and often we get requirements in mobile application or a mail send to lead from salesforce to contain these QR code .

There has been lot of talks and debates on usability of this technology .Infact google has deprecated the API. Nevertheless some customers still prefer this technology and we often find QR codes in business cards ,front page of books ,Quotes and so on.

So this blog post demonstrates how to form the QR code in salesforce with the help of the qrserver

Please make sure to read the terms and conditions of the before using the QR code API for commercial  purpose .

There is already a good blog post from one of the MVP on this and hence it was very simple task for me to read and follow.Here is the link to the blog and it was nicely written.

The above blog used google chart API but since google have deprecated this API ,i had to look for the other websites providing me the API.

There were couple of good websites .


In this blog i will be describing how to use formula field to generate the QR code using the API .The procedure remains same as we use with google chart API as demonstrated in the blog.

My assumptions are i have employee custom object and i have a formula field named QRCode and remote site settings has been configured for the .

so here is the formula using IMAGE function of the salesforce on how to bring the QR code from the

IMAGE(''+ Name ,'hello',50,50)

Make sure to specify URL in small caps in image tag.For the readability purpose i have made all caps and in actual those are in small caps

data field consists of the content that will be displayed once the QR code is scanned by the reader.

Please note how the variable Name is used .Actually its  a merge field used from the formula editor and hence for each record this is dynamically populated .

50-Height of the image in pixel

50-Width of the image in pixel.

'hello '-string that will be displayed in case image fails to renders 

The QR image can be easily scanned with QR readers.There are number of readers available for mobile and the desktop.

I downloaded a QR code reader for my desktop from the URL below and works great .

From the screen the reader automatically scans the QR code and decodes the Text in it .

A small hint incase you need this image on the visualforce page here is the code to help

Hope the above information is helpful for people looking for sample approach on QR code generation in salesforce.


Saturday, 2 February 2013

Problem with WSS or WSP headers in WSDL while using WSDL-APEX

WSDL to APEX is really a good feature to Support SOAP API callouts to the external system in

Although this feature provides us the stub classes for us to make callout usually its not simple to parse the WSDL to the apex classes .Reason being this out-of-box feature has numerous limitation and as a technical architect or an integration specialist must be aware of these limitations

Here is the link to the document where the limitations are documented in sfdc

I came across a situation of late where i was able to parse the WSDL and generate the API classes still i was not able to make callout with exception saying authentication failed .

For authentication its usually best to use HTTP headers and even WSDL to apex does support addition of HTTP headers .To understand this again the above link is very helpful.

My problem was more weird i had authentication headers in my WSDL and it had tags using WSS and WSP.

What are actually WSP and WSS?

I went to the link above and read the document of oracle and its a security protocol for webservices .To deep dig above two links are great.

Coming to my problem again

1)If salesforce WSDL>apex dont support then i should get error while parsing (WSDL parsed out with no issues )
2)How can i make changes to my generated classes if i need to add and make this work?

Thanks to stackexchange.I quickly posted and tweeted to sandeep,Patt and other evangelism at salesforce who can help me

Thankfully Sandeep Bhanot replied saying WSDL>APEX don't support this yet .

So we have only one alternative left is to make a HTTP callout instead by dynamically constructing the XML with SOAP headers .

The above is only an alternative and must be adapted when no other choice left .

Best approach is still look whether the server programming at the other end can be adjusted to use simple HTTP authentication then having authentication in SOAP header.

Hope this helps !Enjoy Integrating with salesforce!

Introducing Lightning Base Components

Lightning Base Components are great addition to the platform and in fact revolutionary .One of the concerns around lightning component ...