Showing posts with label Salesforce. Show all posts
Showing posts with label Salesforce. Show all posts

Visualforce Mashup - AngularJS and Bootstrap

Monday, October 5, 2015 by Aslam - The Alexendra
Hi All,
Here is a new blog post from my collegue on AngularJS, Bootstrap and Visualforce. You will get some cool knowledge about how to make a demo with these adhoc web technologies. Please check full post here:


Read More

Salesforce Visualforce Signature Tool

Tuesday, September 15, 2015 by Aslam - The Alexendra
Hi All,
This is a simple demo which will guide you to create a form with "Signature Canvas" to take initials from user and stores that in document and also displays it in a PDF file. It can be used for initials in an Agreement, Terms and Condition, Authorized Person and various other places...

Read More

Salesforce Context Menu for list views

Tuesday, May 20, 2014 by Aslam - The Alexendra
Hi All,
This is a quick demo for a utility component. I designed it for standard salesforce list views. Its a kind of context menu which can be opened on clicking of a IMAGE formula field. You can show your useful menu options in this context menu. Each option can have the record id automatically by JS, so that your target page or screen can have proper processing based on passed record id.


How to configure:
  1. Make a IMAGE formula field as given in screeshot above
  2. Upload the menu-resources.zip file available on this url
     http://www.aslambari.com/downloads/menu-resources.zip
  3. Make one home page component (HTML type and Narrow side)
  4. Put below code in that component
<!-- include files --> <script src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"></script> <link rel="stylesheet" href="/resource/1400648652000/dupedetector__menu_resources/menu-resources/menu.css"> <!-- HTML Menu --> <div class="dropdown-menu" id="dropdown-menu"> <a href="/003?rlid=RelatedContactList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/application_view_detail.png" /> Sync Contacts </a> <a href="/006?rlid=RelatedOpportunityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/calendar-disabled.png"> Export Orders</a> <a href="/005?rlid=RelatedCaseList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/zip.png"/> View Cases </a> <div class="break"></div> <a href="/_ui/core/chatter/ui/ChatterPage" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/connect_light_small_short.gif"/> Sync Feeds</a> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/phone.png"/> Calls History </a> <a href="/002?parent_id=001900000054UZ7&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/3668432.png"/> Box.Net Documents </a> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/feature_gmail_icon.gif"/> Google Mails </a> <div class="break"></div> <a href="00T?rlid=RelatedActivityList&amp;id=" target="_BLANK"> <img src="/resource/1400648652000/dupedetector__menu_resources/menu-resources/delete.png"/> Delete Logs </a> </div> <!-- JS Part --> <script> function init_sfdc_menu(){ $('.x-grid3-col-00N9000000A4pIp').click(function(event){ event.stopPropagation(); var id = $(this).attr("id").split("_")[0]; $('.dropdown-menu').css( {position:"absolute", top:event.pageY-100, left: event.pageX-30}); $('.dropdown-menu').find('a').each(function(){ var oldhref = $(this).attr("href"); oldhref = oldhref.substring(0,oldhref.lastIndexOf('=')+1); $(this).attr("href", oldhref + id); }); $('.dropdown-menu').show(); }); $(document).click(function(){ $('.dropdown-menu').hide(); }); } $(document).ready(function(e) { $('#bodyCell').bind('DOMNodeInserted DOMNodeRemoved', function(event) { setTimeout(init_sfdc_menu(),500); }); }); </script>

Changes:
I have designed this component for just showing how to use this utility, so i have not make it very robust or optimize and have left few hard coded ids few places, but any developer who needs to make it work proper, needs to do following changes in files:
  •    Open the menu.css and change hard coded id "00N9000000A4pIp" to your image formula field id on list view
  •    Change the same id available on component code
  •    Once you uploaded your static resource, you will get one timestamp for that which you can see in my component code few places, you need to change it with yours as well and make sure you provide proper url, for example my url for jquery.js is this:
   "/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"
   You need to change this url with yours.
  
Here is a screencast you can see how it works.


Email if for any issue, happy coding :)


Thanks
Aslam Bari
http://www.aslambari.com

Simple JavaScript Salesforce Validation - jSFValidation

Thursday, September 12, 2013 by Aslam - The Alexendra
Hi All,
Today I am going to give a demo for JS validation for VF pages which works mostly like native SFDC field validation. Here you can find the working demo.

http://labsprojects-developer-edition.ap1.force.com/jSFValidationDemo




Right now i have implemented the validation for "Required" type. If any text box values are empty , i am adding the error. You simply need to add the jSFValidation component and then you need to add the class "jSF_Required" on the fields you want to add validation for. In given demo, only "Mailing Country" is not required. Rest of the fields are marked for required.

You can download the code from here.
http://www.aslambari.com/downloads/jSFValidation.zip


Provide your suggestions to improve this :)

Thanks
Aslam Bari

Salesforce, Google Map 3 and jQuery with Clusters

Monday, March 18, 2013 by Aslam - The Alexendra
Hi All,
In past i have posted one blog regarding google map, using jquery and google map version 2. Now since, google have version 3 so i have upgraded my plugin with latest version and also used more featured jquery plugin i found which is gMap3. You can check it here:
http://gmap3.net/en/

I recommend you first refer my earlier version of google map component here:
http://techsahre.blogspot.in/2011/04/sfgmap-salesforce-google-map-jquery.html

I used this jQuery plugin and implemented my own new version of sfGmap, called sfGmap3



 This component has all features like previous component but have one more new feature called Clusters. You can turn On and Off this feature in my component using attribute "useCluster".

Here is a basic usage of this component:
<c:sfgmap3 addressmodel="{!addressmodel}" height="500px" usecluster="true" uselatlng="false" width="100%" zoom="2" />

I used this plugin and created one demo to show historical places in Rajasthan. Thanks to my collegue Rajendar Rathore, who helped me to make database for these places which included lat, long, pictures etc. Here the link for online demo:

http://labsprojects-developer-edition.ap1.force.com/GMapRajasthanPlaces

You can see each cluster is identified by a image, i used Camel image. Once you zoom in, you will keep go inside the cluster and finally you can find the actual place. You can click on each marker and you can find a info window containing image of that place and name like below.



Hope you will like it. Mail me for full code of this demo and let me know suggestions to improve it as always.

Thanks
Aslam Bari
http://www.aslambari.com

Extend Salesforce Rich Text Editor as Multi-Purpose

Sunday, March 10, 2013 by Aslam - The Alexendra
Hi All,
Recently one of client wants some enhancement to existing 'Send Email' screen. They want some functionalities which standard email editor does not support and even salesforce Rich Text Editor also does not support.
I did some research and found that we can extend standard salesforce Rich Text Editor in many ways. One of the enhancement which I did, I am going to show you all.

Client wants a way to fetch all related contacts and opportunities from current account in the email editor on the place he wants and editable and also wants to control as many times as he needed. To achieve this task, I came up with the custom button solution which can be embedded into standard Rich Text Area of salesforce and can attach some event handlers to them.


I created one component called "AddButtonToolbar". In this component, for demo purpose i have created two custom buttons for showContacts and showOpportunities. But you can make as many as you want. Here is the basic configuration you can do:

<apex:component> <apex:attribute name="accountId" type="string" description="passed account id"/> <script src="{!URLFOR($Resource.ckeditor,'ckeditor/jquery-1.4.2.min.js')}"></script> <script> //Event Handler for ShowContacts button //Fetch and prepares the contact table in editor function showContacts(){ // invoke your sfdc method here } //Event Handler for ShowOpportunities button //Fetch and show the opportunities in RTE function showOpportunities(){ // invoke your sfdc method here } /**** Custom buttons configuration Provide name, label, command (js function), and Image for the button */ var config = { "Buttons": [ { "Name" : "Contacts", "Label" : "Show Contacts", "Command": "showContacts", "Image": "{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/16-cube-green.png')}" }, {"Name" : "Opportunities", "Label" : "Show Opportunities", "Command": "showOpportunities", "Image": "{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/contact.png')}" } ] } function initialize(){ for(var i=0; i<config.Buttons.length;i++){ addButton(config.Buttons[i].Name, config.Buttons[i].Image, config.Buttons[i].Command, config.Buttons[i].Label); } } function addButton(name,image,command,label){ $('#cke_21').append('<span class="cke_toolbar_start"></span>'+ '<span role="presentation" class="cke_toolgroup">'+ '<span class="cke_button">'+ '<a onclick="'+command+'();" onblur="this.style.cssText = this.style.cssText;" role="button" hidefocus="true" title="'+label+'" class="cke_button_outdent cke_disabled" id="'+name+'" aria-disabled="true">'+ '<span class="cke_icon" style="background-image:url('+image+');background-position:center;">&nbsp;</span>'+ '<span class="cke_label" id="'+name+'">'+label+'</span>'+ '</a>'+ '</span>'+ '</span>'+ '<span class="cke_toolbar_end"></span>' ); } var defaultFunc = window.onload; window.onload = function() { if(defaultFunc) defaultFunc (); setTimeout("initialize()",1000); } </script> </apex:component>

Line #21-#35 shows configuration option for your buttons.
initialize() method starts creating the buttons.

Here is a working demo for above functionality:
http://labsprojects-developer-edition.ap1.force.com/ExtendRTE?id=001900000054UZ7

You will see two buttons on right side. Click on those buttons to see things in action.

Additionaliy you can put your email address and try to send email to your account to see how email will look.

Mail me for full code as always :)

Thanks
Aslam Bari

Salesforce Remoting & jQuery Drag/Drop Mash-up

Wednesday, February 27, 2013 by Aslam - The Alexendra
Hi All,
Today I am going to show you a good useful mash-up using jQuery Drag/Drop feature with Salesforce Remoting. I have created a simple application where user can see a Dashboard where all Un-Assigned tasks are shown on left side. All available contacts will be available on right side.
Now, user can drag any task from left side list and drop on right side, for any contact. Internally the Task will be assigned to that particular Contact. This is done internally using Salesforce Remoting.
This type of applications are very convenient to use and do the work smoothly.



You can test the application here.
http://labsprojects-developer-edition.ap1.force.com/TaskAssignmentDashboard

Here are few assumptions/points regarding above demo;

1) I have used Contacts to assign the Task but actually we must use Users
2) I have given demo for Tasks, but we can use this application for other useful things like Cases, Leads and Opportunity assignments
3) The demo actually will not update the records in database. I have commented actual database update because of demo purpose. You can only check the drag and drop and assignments.

Mail me if you need the code for above demo.

Your suggestions to improve this app , are always appreciated.

Thanks
Aslam Bari

Salesforce JQuery Mobile Demo

Tuesday, February 12, 2013 by Aslam - The Alexendra
Hi All,
Here I am going to show you a demo of jQuery Mobile development which is using Salesforce Sites. Its very easy and convinient to integrate both technologies which is natively compatible with your mobile. It comes with a very cool native look and feel UI, responsive UI themes and APIs. With couple of tags you can build up your site compatible with multiple devices.



Here is a working demo. I am showing contact list from salesforce. You can search contacts. You can click any contact to see the detail.
http://labsprojects-developer-edition.ap1.force.com/JQMContacts

Open web browser in your mobile phone and open the above url to see in action.

If you need source code for above, drop me an email: aslam.bari@gmail.com

Thanks
Aslam Bari

Simple jQuery Dependent Picklist

Friday, January 18, 2013 by Aslam - The Alexendra

Hi All,
Today I am going to show you how to make dependent picklist on visualforce page with some few lines of code. This is client side dependent list. So it has following benefits:

1) No Action Function or Ajax, means we dont need to call server side script to filter the list of records.
2) Its based on javascript so its fast
3) We can extend the level of dependency



The idea here to use jQuery and one small method to make the dependency. I have got this idea from here.
1) First make your parent select list as below

<select id="accountList" size="1"> <option value="">-Select-</option> <apex:repeat value="{!accounts}" var="acc"> <option value="{!acc.Id}">{!acc.Name}</option> </apex:repeat> </select>
2) Make your child select list. Make sure to give option a class name like this "child_{parent_record_value}".


<select id="contactList" size="1"> <apex:repeat value="{!contacts}" var="con"> <option class="child_{!con.accountid}" value="{!con.Id}">{!con.Name}</option> </apex:repeat> </select>
3) Put the below code in your head section

function prepareList(parent,child,isSubselectOptional){ $("body").append("<select style='display:none' id='"+parent+child+"'></select>"); $('#'+parent+child).html($("#"+child+" option")); $('#'+child).html("<option> — </option>"); $('#'+parent).change(function(){ var parentValue = $('#'+parent).attr('value'); $('#'+child).html($("#"+parent+child+" .child_"+parentValue).clone()); if(isSubselectOptional) $('#'+child).prepend("<option> — Select — </option>"); }); }
4) Call the below method on load of the page. Make sure to pass proper parent and child select list ids.
$(function() { prepareList('accountList','contactList', false); });

Thats it. Now you can see on the page the dependency is created automatically.

You can download the code from here

You can see the working demo here
http://labsprojects-developer-edition.ap1.force.com/DependentPicklist


Thanks
Aslam Bari

Simple Context-Menu For Web Page

Tuesday, January 1, 2013 by Aslam - The Alexendra
Hi All,
Here I am going to give a demo for how you can make a context menu on your web page using few lines of code. Many times such web applications needed where user can do many operations on different kind of records. In that scenario making lot of buttons or checkboxes are easily avoided if you go with context menu.


Context-Menu


How to implement Context-Menu:

1) Make your context-menu html code and put that at the end of body.

<ul id="menu" class="custom-menu"> <li><a href="javascript:alert('Clicked Add Notes');" onclick="addnote();">Add Notes</a></li> <li><a href="javascript:alert('Clicked Add Memos');" id="menu_2">Add Memos</a></li> <hr style="clear:both;color:#E6E6E6" /> <li><a href="javascript:alert('Clicked View Order');" id="menu_4">View Order</a></li> <li><a href="javascript:alert('Clicked View Invoice');" id="menu_5">View Invoice</a></li> <li><a href="javascript:alert('Clicked View Employee');" id="menu_3">View Employee</a></li> </ul>

2) Include jQuery main js file, in our case i have used jquery-1.8.3.js

3) Put below code in your head section of html file

<script> $(function() { $(".emp").bind("contextmenu", function(event) { event.preventDefault(); $("#menu").show(); $("#menu").css({top: event.pageY + "px", left: event.pageX + "px"}); }); $(document).bind("click", function(event) { $("#menu").hide(); }); }); </script>


Here #menu is Id of your html menu area, ".emp" is the class name of element on which you want to bind this context-menu on right click.

4) Give some good look to your menu, put below code in your head section style tag

<style> .custom-menu { z-index:1000; position: absolute; background-color:#FFF; border: 1px solid black; padding: 5px; list-style: none; width:150px; display:none; } .custom-menu a{ text-decoration: none; padding:5px; font-size:13px; width:100px; display:block; color:#000; } .custom-menu a:hover{ text-decoration: none; border:1px solid #ccc; background-color:greenyellow; } .custom-menu li{ margin:5px; } </style>


5) Now, design your web page and give class "emp" to the elment where you want this context menu to open.

Here is working demo:
http://labs.aslambari.com/context-menu/contextmenu.html
Click the names of employee on the page, you will see the context-menu

You can download complete code here:
http://aslambari.com/downloads/context-menu.zip

Let me know your thoughts

Thanks
Aslam Bari



Change Email Utility - Salesforce

Thursday, October 11, 2012 by Aslam - The Alexendra
Hi All,
Here i am introducing one utility created by me. It is used to change the email address of salesforce org. You must have username, password and security token for the org. 




How to access utility?
You can access this utility from my site, here is the url:

Why and When you need this?
I recently came across one situation when i deadly need this utility. One of my colleague recently setup one new salesforce org. He given his username, password, email for the org. He completed his work and sent me details about username, password, security token as well. After couple of hours, when i tried to login and test from my home, i was unable to login because my IP is not white listed. I called my colleague, but his phone was off, and its DEADLINE for me to give this info to client to show him all the work. My IP was not white listed so i can't login, the email address assigned to org was for my colleague , so i even can't get the activation code. What to do?
Then i thought to create this utility.

Benefits:
You can change email address of the user of the salesforce org. You must know username, password and security token. This utility only send you a Email Change notification. You will get one email. You can accept that verification email change. After that when you try to login from browser using username and password, then you can easily get verification code of the org as your email address is now changed for given org.

Let me know your thoughts on this utility.

Thanks
Aslam Bari