Hide
Siafoo is here to make coding less frustrating and to save you time. Join Siafoo Now or Learn More

Leads Rolodex using SharePoint Data Zoom Extension for salesforce.com Atom Feed 0

In Brief Leads Rolodex script provided for SharePoint Data Zoom Extension for salesforce.com. This script provides you with a filterable and sortable directory of all your organization's salesforce.com leads. SharePoint Data Zoom Web Part Extension for salesforce.com required.
# 's
  1## SalesForce Leads Rolodex v1.0
2## by SharePoint Solutions
3
4## Get search inputs
5#set( $id = $queryString.get_item("Id") )
6#set( $searchCriteria = $form.get_item("searchCriteria") )
7#set( $searchType = $form.get_item("searchType") )
8#set( $rolodex = $form.get_item("rolodex") )
9
10## Get paging attributes
11#set( $pageIndex = $Strings.ConvertToInt($form.get_item("pageIndex"), 0) )
12#set( $pageSize = $Strings.ConvertToInt($form.get_item("pageSize"), 15) )
13
14## Add filter terms
15#if( !$Strings.IsNullOrEmpty($id) && $request.HttpMethod == "GET" )
16
17 #set( $searchFilter = "$id" )
18 #set( $searchType = "Id" )
19
20#elseif( !$Strings.IsNullOrEmpty($rolodex) )
21
22 #if( $rolodex == "All" )
23 #set( $searchFilter = "" )
24 #set( $searchCriteria = "" )
25 #else
26 #set( $searchFilter = "LastName like '${rolodex}%'" )
27 #set( $searchCriteria = "${rolodex}" )
28 #set( $searchType = "LastName" )
29 #end
30
31#elseif( !$Strings.IsNullOrEmpty($searchCriteria) )
32
33 #set( $searchFilter = "$searchType Like '%${searchCriteria}%'" )
34#end
35
36<script>
37<!--
38
39function applySearch()
40{
41 document.getElementById("pageIndex").value = "0";
42 document.getElementById("rolodex").value = "";
43 theForm.submit();
44}
45
46function setPageSize()
47{
48 document.getElementById("pageIndex").value = "0";
49 theForm.submit();
50}
51
52function gotoPageIndex(pageIndex)
53{
54 document.getElementById("pageIndex").value = pageIndex;
55 theForm.submit();
56}
57
58function gotoRolodex(rolodex)
59{
60 document.getElementById("pageIndex").value = "0";
61 document.getElementById("rolodex").value = rolodex;
62 theForm.submit();
63}
64
65-->
66</script>
67
68<div style="padding:10px;">
69
70<span class="ms-linksectionheader"><h3 class="ms-standardheader">Search</h3></span>
71<blockquote style="margin:10px">
72
73<!-- Search area -->
74<input type="hidden" name="pageIndex" value="$!{pageIndex}" />
75<input type="hidden" name="rolodex" value="$!{rolodex}" />
76<table cellpadding="2" cellspacing="0">
77 <tr>
78 <td>Find a user whose
79 <select name="searchType">
80 <option value="LastName" #if($searchType == "LastName")selected #end>Last Name</option>
81 <option value="FirstName" #if($searchType == "FirstName")selected #end>First Name</option>
82 <option value="Email" #if($searchType == "Email") selected #end>E-Mail Address</option>
83 </select>
84 contains
85 <input type="text" name="searchCriteria" value="$!{searchCriteria}" />
86 </td>
87 <td>
88 <a title="Find Account" href="javascript:applySearch();">
89 <img title="Go Search" alt="Find Employee" src="/_layouts/images/gosearch.gif" style="border-width:0px;" />
90 </a>
91 </td>
92 </tr>
93</table>
94</blockquote>
95
96<span class="ms-linksectionheader"><h3 class="ms-standardheader">Rolodex</h3></span>
97<blockquote style="margin:10px">
98
99<!-- Rollidex -->
100<table cellpadding="2" cellspacing="2">
101 <tr>
102 #foreach($index in [0..10])
103 <td class="ms-vb"><a href="javascript:gotoRolodex('$index');">$index</a></td>
104 #end
105
106 #foreach($index in ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"])
107 <td class="ms-vb"><a href="javascript:gotoRolodex('$index');">$index</a></td>
108 #end
109
110 <td class="ms-vb"><a href="javascript:gotoRolodex('All');">All</a></td>
111 <tr>
112</table>
113</blockquote>
114
115## Setup Active Directory variables
116#set( $properties =["Id", "FirstName", "LastName", "Email", "Company", "Status", "Phone"] )
117
118## Get the matching entries
119#set( $sfaLeads = $ApexLeads.GetLeads($searchFilter, "LastName,FirstName", $pageIndex, $pageSize, $properties) )
120
121## Get the result data
122#set( $firstItemNumber = $pageIndex * $pageSize + 1 )
123#set( $lastItemNumber = $firstItemNumber + $sfaLeads.Count - 1 )
124#set( $prevPageIndex = $pageIndex - 1 )
125#set( $nextPageIndex = $pageIndex + 1 )
126
127<!-- Toolbar -->
128<table class="ms-menutoolbar" cellpadding="5" cellspacing="0" border="0" width="95%" >
129 <tr>
130 <td class="ms-toolbar"></td>
131
132 <td width="99%" class="ms-toolbar" nowrap><IMG SRC="/_layouts/images/blank.gif" width=1 height=18 alt=""></td>
133
134 <td class="ms-toolbar" nowrap="true">
135 <table cellpadding="0" cellspacing="0" border="0">
136 <tr>
137 #if( $pageIndex > 0 )
138 <td><img src="/_layouts/images/prev.gif" border="0" alt="Previous Page" onclick="gotoPageIndex($prevPageIndex);" /></td>
139 #end
140
141 <td class="ms-listheaderlabel" nowrap>&nbsp;${firstItemNumber}-${lastItemNumber}&nbsp;</td>
142
143 #if( $sfaLeads.Count == $pageSize )
144 <td><img src="/_layouts/1033/images/next.gif" border="0" alt="Next Page" onclick="gotoPageIndex($nextPageIndex);" /></td>
145 #end
146 </tr>
147 </table>
148 </td>
149
150 <td class=ms-separator>|</td>
151
152 <td class="ms-toolbar" nowrap="true">Show &nbsp;&nbsp;</td>
153 <td class="ms-toolbar" nowrap="true">
154 <select name="pageSize" onchange="setPageSize();">
155 <option value="5" #if($pageSize == 5) selected #end>5</option>
156 <option value="10"#if($pageSize == 10) selected #end>10</option>
157 <option value="15"#if($pageSize == 15) selected #end>15</option>
158 <option value="50"#if($pageSize == 50) selected #end>50</option>
159 <option value="100"#if($pageSize == 100) selected #end>100</option>
160 </select>
161 </td>
162
163 <td>&nbsp;&nbsp;&nbsp;</td>
164 </tr>
165</table>
166
167<!-- Results area -->
168#foreach( $sfaLead in $sfaLeads)
169 #beforeall
170 <table class="ms-listviewtable" cellpadding="8" cellspacing="0" width="95%" border="0">
171 <tr class="ms-viewheadertr">
172 <th class="ms-vh2-nofilter">First Name</th>
173 <th class="ms-vh2-nofilter">Last Name</th>
174 <th class="ms-vh2-nofilter">E-Mail Address</th>
175 <th class="ms-vh2-nofilter">Phone Number</th>
176 <th class="ms-vh2-nofilter">Company Name</th>
177 <th class="ms-vh2-nofilter">Status</th>
178 </tr>
179 #odd
180 <tr class="">
181 #even
182 <tr class="ms-alternating">
183 #each
184 <td class="ms-vb2"><a href="$serverVariables.get_item("PATH_INFO")?accountName=$membershipUser.AccountName">$sfaLead.FirstName</a></td>
185 <td class="ms-vb2">$sfaLead.LastName</td>
186 <td class="ms-vb2">$!{sfaLead.Email}</td>
187 <td class="ms-vb2">$!{sfaLead.Phone}</td>
188 <td class="ms-vb2">$!{sfaLead.Company}</td>
189 <td class="ms-vb2">$!{sfaLead.Status}</td>
190 #after
191 </tr>
192 #afterall
193 </table>
194 #nodata
195 <div style="padding:10px">No leads found</div>
196#end
197
198<div>

Leads Rolodex script provided for SharePoint Data Zoom Extension for salesforce.com. This script provides you with a filterable and sortable directory of all your organization's salesforce.com leads. SharePoint Data Zoom Web Part Extension for salesforce.com required.