1WWW::Salesforce(3) User Contributed Perl Documentation WWW::Salesforce(3)
2
3
4
6 WWW::Salesforce - this class provides a simple abstraction layer
7 between SOAP::Lite and Salesforce.com.
8
10 use WWW::Salesforce;
11 my $sforce = eval { WWW::Salesforce->login( username => 'foo',
12 password => 'bar' ); };
13 die "Could not login to SFDC: $@" if $@;
14
15 # eval, eval, eval. WWW::Salesforce uses a SOAP connection to
16 # salesforce.com, so things can go wrong unexpectedly. Be prepared
17 # by eval'ing and handling any exceptions that occur.
18
20 This class provides a simple abstraction layer between SOAP::Lite and
21 Salesforce.com. Because SOAP::Lite does not support complexTypes, and
22 document/literal encoding is limited, this module works around those
23 limitations and provides a more intuitive interface a developer can
24 interact with.
25
26 METHODS
27 login( HASH )
28 The "login" method returns an object of type WWW::Salesforce if the
29 login attempt was successful, and 0 otherwise. Upon a successful
30 login, the sessionId is saved and the serverUrl set properly so
31 that developers need not worry about setting these values manually.
32 Upon failure, the method dies with an error string.
33
34 The following are the accepted input parameters:
35
36 username
37 A Salesforce.com username.
38
39 password
40 The password for the user indicated by "username".
41
42 convertLead( HASH )
43 The "convertLead" method returns an object of type SOAP::SOM if the
44 login attempt was successful, and 0 otherwise.
45
46 The following are the accepted input parameters:
47
48 %hash_of_array_references
49 leadId => [ 2345, 5678, ],
50 contactId => [ 9876, ],
51
52 create( HASH )
53 Adds one new individual objects to your organization's data. This
54 takes as input a HASH containing the fields (the keys of the hash)
55 and the values of the record you wish to add to your arganization.
56 The hash must contain the 'type' key in order to identify the type
57 of the record to add.
58
59 Returns a SOAP::Lite object. Success of this operation can be
60 gleaned from the envelope result.
61
62 $r->envelope->{Body}->{createResponse}->{result}->{success};
63
64 delete( ARRAY )
65 Deletes one or more individual objects from your organization's
66 data. This subroutine takes as input an array of SCALAR values,
67 where each SCALAR is an sObjectId.
68
69 query( HASH )
70 Executes a query against the specified object and returns data that
71 matches the specified criteria.
72
73 query
74 The query string to use for the query. The query string takes
75 the form of a basic SQL statement. For example, "SELECT Id,Name
76 FROM Account".
77
78 limit
79 This sets the batch size, or size of the result returned. This
80 is helpful in producing paginated results, or fetch small sets
81 of data at a time.
82
83 queryMore( HASH )
84 Retrieves the next batch of objects from a "query".
85
86 queryLocator
87 The handle or string returned by "query". This identifies the
88 result set and cursor for fetching the next set of rows from a
89 result set.
90
91 limit
92 This sets the batch size, or size of the result returned. This
93 is helpful in producing paginated results, or fetch small sets
94 of data at a time.
95
96 update(type => $type, HASHREF [, HASHREF ...])
97 Updates one or more existing objects in your organization's data.
98 This subroutine takes as input a type value which names the type of
99 object to update (e.g. Account, User) and one or more perl HASH
100 references containing the fields (the keys of the hash) and the
101 values of the record that will be updated.
102
103 The hash must contain the 'Id' key in order to identify the record
104 to update.
105
106 upsert(type => $type, key => $key, HASHREF [, HASHREF ...])
107 Updates or inserts one or more objects in your organization's data.
108 If the data doesn't exist on Salesforce, it will be inserted. If
109 it already exists it will be updated.
110
111 This subroutine takes as input a type value which names the type of
112 object to update (e.g. Account, User). It also takes a key value
113 which specificies the unique key Salesforce should use to determine
114 if it needs to update or insert. If key is not given it will
115 default to 'Id' which is Salesforces own internal unique ID. This
116 key can be any of Salesforces default fields or an custom field
117 marked as an external key.
118
119 Finally, this method takes one or more perl HASH references
120 containing the fields (the keys of the hash) and the values of the
121 record that will be updated.
122
123 getServerTimestamp()
124 Retrieves the current system timestamp (GMT) from the sforce Web
125 service.
126
127 getUserInfo( HASH )
128 Retrieves personal information for the user associated with the
129 current session.
130
131 user
132 A user ID
133
134 getUpdated( HASH )
135 Retrieves the list of individual objects that have been updated
136 (added or changed) within the given timespan for the specified
137 object.
138
139 type
140 Identifies the type of the object you wish to find updates for.
141
142 start
143 A string identifying the start date/time for the query
144
145 end A string identifying the end date/time for the query
146
147 getDeleted( HASH )
148 Retrieves the list of individual objects that have been deleted
149 within the given timespan for the specified object.
150
151 type
152 Identifies the type of the object you wish to find deletions
153 for.
154
155 start
156 A string identifying the start date/time for the query
157
158 end A string identifying the end date/time for the query
159
160 describeSObject( HASH )
161 Describes metadata (field list and object properties) for the
162 specified object.
163
164 type
165 The type of the object you wish to have described.
166
167 describeLayout( HASH )
168 Describes metadata about a given page layout, including layouts for
169 edit and display-only views and record type mappings.
170
171 type
172 The type of the object you wish to have described.
173
174 describeGlobal()
175 Retrieves a list of available objects for your organization's data.
176
177 setPassword( HASH )
178 Sets the specified user's password to the specified value.
179
180 userId
181 A user Id.
182
183 password
184 The new password to assign to the user identified by "userId".
185
186 resetPassword( HASH )
187 Changes a user's password to a server-generated value.
188
189 userId
190 A user Id.
191
192 retrieve( HASH )
193 fields
194 A comma delimitted list of field name you want retrieved.
195
196 type
197 The type of the object being queried.
198
199 ids The ids (LIST) of the object you want returned.
200
201 search( HASH )
202 searchString
203 The search string to be used in the query. For example, "find
204 {4159017000} in phone fields returning contact(id, phone,
205 firstname, lastname), lead(id, phone, firstname, lastname),
206 account(id, phone, name)"
207
209 login()
210 use WWW::Salesforce;
211 my $sf = WWW::Salesforce->login( 'username' => $user,'password' => $pass )
212 or die $@;
213
214 search()
215 my $query = 'find {4159017000} in phone fields returning contact(id, phone, ';
216 $query .= 'firstname, lastname), lead(id, phone, firstname, lastname), ';
217 $query .= 'account(id, phone, name)';
218 my $result = $sforce->search( 'searchString' => $query );
219
221 Please visit Salesforce.com's user/developer forums online for
222 assistance with this module. You are free to contact the author
223 directly if you are unable to resolve your issue online.
224
226 The "describeSObjects" and "describeTabs" API calls are not yet
227 complete. These will be completed in future releases.
228
229 Not enough test cases built into the install yet. More to be added.
230
232 L<DBD::Salesforce> by Jun Shimizu
233 L<SOAP::Lite> by Byrne Reese
234
235 Examples on Salesforce website:
236 L<http://www.sforce.com/us/docs/sforce70/wwhelp/wwhimpl/js/html/wwhelp.htm>
237
239 This Perl module was originally provided and presented as part of the
240 first Salesforce.com dreamForce conference on Nov. 11, 2003 in San
241 Francisco.
242
244 Fred Moyer <fred at redhotpenguin dot com>
245
246 Thanks to:
247
248 Chase Whitener <cwhitener at gmail dot com> - Maintaining this module
249 and working on development version.
250
251 Michael Blanco - Finding and fixing some bugs.
252
253 Garth Webb - Finding and fixing bugs. Adding some additional features
254 and more constant types.
255
256 Ron Hess - Finding and fixing bugs. Adding some additional features.
257 Adding more tests to the build. Providing a lot of other help.
258
259 Tony Stubblebine - Finding a bug and providing a fix.
260
261 Jun Shimizu - Providing more to the WWW::Salesforce::Constants module
262 and submitting fixes for various other bugs.
263
264 Byrne Reese - <byrne at majordojo dot com> - Byrne Reese wrote the
265 original Salesforce module.
266
268 Copyright 2010 Fred Moyer, All rights reserved.
269
270 Copyright 2005-2007 Chase Whitener.
271
272 Copyright 2003-2004 Byrne Reese, Chase Whitener. All rights reserved.
273
275 This library is free software and may be distributed under the same
276 terms as perl itself.
277
278
279
280perl v5.12.2 2010-10-30 WWW::Salesforce(3)