Get signature tag in Docusign using Apex

To get signature tag in Docusign document use following apex code.

DocuSignTK.Tab signHereTab = new DocuSignTK.Tab();
        signHereTab.Type_x = ‘SignHere’;
        signHereTab.AnchorTabItem = new DocuSignTK.AnchorTab();
        signHereTab.AnchorTabItem.AnchorTabString = ‘Signer_1’;
        signHereTab.AnchorTabItem.XOffset = 8;
        signHereTab.RecipientID = 1;
        signHereTab.Name = ‘Please sign here’;
        signHereTab.ScaleValue = 1;
        signHereTab.TabLabel = ‘signer1sig’;
        envelope.Tabs = new DocuSignTK.ArrayOfTab();
        envelope.Tabs.Tab = new DocuSignTK.Tab[2];

Pair programming

Few weeks back we had resources available so I was part of pair in pair programming. According to Wikipedia Pair programming is an agile software development technique in which two programmers work together at one workstation.

While doing programming in pair I was thinking myself as two-headed monster working on a single machine.


Image source :

Salesforce anonymous web service

To make a web service in Salesforce so that it could be accessed without providing user credentials you need to follow steps below :

Create a apex class

global class WebTestClass {

    global static String createContact(String Name) {
        CusotmObject c = new CustomObject();
        c.lastname = Name;        
        insert c;
        return ‘Success’;


Go to Setup>Develop>Sites and click site label (I am expecting that you have created site in Salesforce or you can follow these instructions

Click Public Access Settings


Edit and set following permission for your custom object


Enable your apex class access


To allow only specific IP to access your web service restrict IP range.


to verify if your web service working go to

and provide payload like this in body {“Name”:”WebServiceTest”}

and add header

“Content-Type” “application/json; charset=UTF-8”


When you launch request it will create new record.


MIXED_DML way around

If you are getting MIXED_DML error or “MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): <setupObject>, original object: <notSetupObject>:

In your test class where you are using setup call use below code:

User currentUser= [ select id from User where id = :UserInfo.getUserId() ];
System.runAs (currentUser) {
//You Setup code here

Salesforce rubber duck debugging

I was a rubber duck last week. My colleague asked me to sit with him to review code snippet and due to complexity of that code I asked him to explain me what he wrote in Apex. While explaining me he found the cause of the issue himself .

If you are playing cricket getting duck award is last thing you would expect but in programming if you are duck it means you are doing something useful for the project.

According to wiki:

Rubber duck debugging is an informal term used in software engineering for a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck. 


JSForce quick start example

If you have followed the steps mentioned in this blog you can keep reading this.

This blog is for quick start to get data from Salesforce environment.

Execute npm install jsforce command


Change these variable values in App.js:


App.Js Copy code from this pdf and save it as App.js

Run node app.js in command prompt and go to http://localhost:3000/ to view result. It will return number of accounts in the Salesforce environment.

Node.Js Hello World Tutorial

Go to and download recommended version.


Go to command prompt and run following command

npm install express


Copy this code and save it into app.js and any location.

var express = require(‘express’);
var app = express();
app.get(‘/’, function (req, res) {
  res.send(‘Hello World!’);
app.listen(3000, function () {
console.log(‘Example app listening on port 3000!’);

I have saved app.js on desktop so I will go to desktop and run this command


And paste this URL on your browser http://localhost:3000/

Congratualtions you have executed your first Hello World for node.Js

Record type name in Visualforce page

If you need to print record type name in visualforce page use following code :


public string CustomRecordType{
get {

for (Schema.RecordTypeInfo rtInfo : Account.SObjectType.getDescribe().getRecordTypeInfos()) {
if (rtInfo.isDefaultRecordTypeMapping()) {

return CustomRecordType;



//—————-Visualforce Page————————


//—————-Visualforce Page————————