Thursday, 22 August 2013

Generating pdf Using Conga Composer

Conga Composer lets you to create documents from a button or link placed on a page layout. It merges data with Word, Excel, PowerPoint, email, or PDF templates to create finished documents.

Benefit Of Conga Composer

  • Easily create and deliver customized documents, 
  • Presentations and reports using Word, PowerPoint, Excel, HTML email and PDF forms from standard & custom objects. 
  • Generate quotes, proposals, account plans, invoices, contracts, letters & more.
In order to use Conga Composer, we need to install two things.
  •     Conga Composer 
  •     Conga Query Manager.

If we need to use some related object's record then Conga Query Manager is necessary otherwise Conga Composer is enough.

How to Install Conga Composer

Go through this link for installation .

How to Install Conga Query Manager

Go through this link for installation .

We already have some sample design in our local drive which signifies how the information will be presented , If we don't have then we will make one using word or anything else.

Now we will create  Conga Template and Conga Query.

Creating Conga Template

Click New button on Conga Template to create one template
After template creation ,click on AttachFile button to attach some sample template from your local drive.

Creating Conga Query

If we have to display some related object record then we have to create conga query to pull data from salesforce, here we can define as many query as want.
There is field called SOQL Select Statement where we have to write query.
For example query will be like this 

SELECT invoiceit_s__Accounting_Code__c, invoiceit_s__Charge_Date__c, invoiceit_s__Service_End_Date__c, invoiceit_s__Service_Start_Date__c, CreatedById   FROM invoiceit_s__Invoice_Lines__c WHERE invoiceit_s__Invoice__c = '{pv0}

Here we are querying data from invoice lines that means button must be in invoice page.

There are two different approach for generating document.

  • By Clicking a Button
  • Some Automation process by using Work flow  

By Clicking a Button
  • Create a custom button on master object 
  • Choose content source as URL
  • paste this code{!API.Session_ID}
   &Id={!Credit_Note__c.Id} //object id where button is present
   &PartnerCode=0015000000Yd8nM // optionals 
  &EmailToId={!Credit_Note__c.Billing_ContactId__c}//to whom emil is going
  &EmailRelatedToId={!Credit_Note__c.Id}//object id where button is present
  &TemplateId=a0mb0000000KYO0 // conga templae id which you have created
  &QueryID=[CreditLines]a0nb0000000zgUE //conga query id, you can give many query id by using comma

How to use Conga Composer 

Go through this pdf 

Automation Process
  • Create one formula field and one checkbox field on mater object.
  • When that check box is true then workflow will be fired.
  • Create a email template through which email will be going to the customer.
  • In the formula field paste this code 

   +"&TemplateId=a0pW000000335Xt" //conga template id
   +"&EmailTemplateId=00XW0000000M8Hp" //the emailtemplate id which you have created
   + "&EmailToId=" + invoiceit_s__Billing_Contact__c 
   +"&QueryID=a11W0000000ov1y,a11W0000000ov1t" //conga query id

  • Create work flow and an outbound message.
  • Give End point Url as
  • Select that formula field Account fields to send to selected fields.
  • Click on Save
Now work flow and outbound message is ready, when that checkbox will be ready a mail with attachment will reach to the contact's email.
For more information about salesforce conga work flow , please go through this pdf

Tuesday, 13 August 2013

LIKE Operator In Salesforce

The LIKE operator in SOQL and SOSL is quite similar to the LIKE operator in SQL; it provides a mechanism for matching partial text strings and includes support for wildcards.

Suppose we need to delete some test records of Account object, all test records are created having account name is test. Account name may "testasish" or "accounttest", how can we get those record by Soql query ?
For this propose LIKE operator is useful.

For example 
List<Account> listOfAccounts;
listOfAccounts = [SELECT id, Name
                           FROM Account
                           WHERE Name  LIKE '%test%'];
This query matches both testasish,accounttest, and test.

Use Cases Of LIKE Operator

  • The % and _ wildcards are supported for the LIKE operator.
  • The % wildcard matches zero or more characters.
  • The _ wildcard matches exactly one character.
  • The text string in the specified value must be enclosed in single quotes.
  • The LIKE operator is supported for string fields only.
  • The LIKE operator performs a case-insensitive match, unlike the case-sensitive matching in SQL.
  • The LIKE operator in SOQL and SOSL supports escaping of special characters % or _.
  • Do not use the backslash character in a search except to escape a special character.