Wednesday, March 2, 2016

How to append stars on lead object based on the no.of checkboxes checked by using formula field in salesforce.

 On lead object say I have 3 custom checkbox fields namely ch1__c,ch2__c and ch3__c.
  If anyone checkbox field is selected only one star has to be displayed on lead object.
  Similarly if any two checkbox fields are selected, two stars has to be displayed and 
  if any three checkbox fields are selected, three stars has to be displayed on Lead object.



1)Store the 1star, 2star, 3star images in documents and enable externally available image for all      the three document files.
2)Create custom formula field of type text and write the formula as below and save it.

Case((IF((ch1__c=false), 0, 1) + IF((ch2__c=false), 0, 1) + IF((ch3__c=false), 0, 1)),
1, IMAGE("https://------copy and paste the image source here-------", "give alternate text", length, width),
2, IMAGE("https://------copy and paste the image source here-------", "2 star", 60, 100),
3, IMAGE("https://------copy and paste the image source here-------", "3 star", 60, 100),
"0 stars")

Note: For image source just open document file right click on the image and copy the image address.
alternate text can be any name, length and width of the image can be set as required.

No comments:

Post a Comment