1WWW::Salesforce(3)    User Contributed Perl Documentation   WWW::Salesforce(3)
2
3
4

NAME

6       WWW::Salesforce - this class provides a simple abstraction layer
7       between SOAP::Lite and Salesforce.com.
8

SYNOPSIS

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

DESCRIPTION

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

CONSTRUCTORS

27   new( HASH )
28       Synonym for "login"
29
30   login( HASH )
31       The "login" method returns an object of type WWW::Salesforce if the
32       login attempt was successful, and 0 otherwise. Upon a successful login,
33       the "sessionId" is saved and the serverUrl set properly so that
34       developers need not worry about setting these values manually. Upon
35       failure, the method dies with an error string.
36
37       The following are the accepted input parameters:
38
39       username
40           A Salesforce.com username.
41
42       password
43           The password for the user indicated by "username".
44

METHODS

46   convertLead( HASH )
47       The "convertLead" method returns an object of type SOAP::SOM if the
48       login attempt was successful, and 0 otherwise.
49
50       Converts a Lead into an Account, Contact, or (optionally) an
51       Opportunity
52
53       The following are the accepted input parameters:
54
55       %hash_of_array_references
56               leadId => [ 2345, 5678, ],
57               contactId => [ 9876, ],
58
59   create( HASH )
60       Adds one new individual objects to your organization's data. This takes
61       as input a HASH containing the fields (the keys of the hash) and the
62       values of the record you wish to add to your organization.  The hash
63       must contain the 'type' key in order to identify the type of the record
64       to add.
65
66       Returns a SOAP::Lite object.  Success of this operation can be gleaned
67       from the envelope result.
68
69           $r->envelope->{Body}->{createResponse}->{result}->{success};
70
71   delete( ARRAY )
72       Deletes one or more individual objects from your organization's data.
73       This subroutine takes as input an array of SCALAR values, where each
74       SCALAR is an "sObjectId".
75
76   describeGlobal()
77       Retrieves a list of available objects for your organization's data.
78       You can then iterate through this list and use "describeSObject()" to
79       obtain metadata about individual objects.  This method calls the
80       Salesforce describeGlobal method
81       <https://developer.salesforce.com/docs/atlas.en-
82       us.api.meta/api/sforce_api_calls_describeglobal.htm>.
83
84   describeLayout( HASH )
85       Describes metadata about a given page layout, including layouts for
86       edit and display-only views and record type mappings.
87
88       type
89           The type of the object you wish to have described.
90
91   describeSObject( HASH )
92       Describes metadata (field list and object properties) for the specified
93       object.
94
95       type
96           The type of the object you wish to have described.
97
98   describeSObjects( type => ['Account','Contact','CustomObject__c'] )
99       An array based version of describeSObject; describes metadata (field
100       list and object properties) for the specified object or array of
101       objects.
102
103   describeTabs()
104       Use the "describeTabs" call to obtain information about the standard
105       and custom apps to which the logged-in user has access. The
106       "describeTabs" call returns the minimum required metadata that can be
107       used to render apps in another user interface. Typically this call is
108       used by partner applications to render Salesforce data in another user
109       interface.
110
111   get_session_id()
112       Gets the Salesforce SID
113
114   get_user_id()
115       Gets the Salesforce UID
116
117   get_username()
118       Gets the Salesforce Username
119
120   getDeleted( HASH )
121       Retrieves the list of individual objects that have been deleted within
122       the given time span for the specified object.
123
124       type
125           Identifies the type of the object you wish to find deletions for.
126
127       start
128           A string identifying the start date/time for the query
129
130       end A string identifying the end date/time for the query
131
132   getServerTimestamp()
133       Retrieves the current system timestamp (GMT) from the Salesforce web
134       service.
135
136   getUpdated( HASH )
137       Retrieves the list of individual objects that have been updated (added
138       or changed) within the given time span for the specified object.
139
140       type
141           Identifies the type of the object you wish to find updates for.
142
143       start
144           A string identifying the start date/time for the query
145
146       end A string identifying the end date/time for the query
147
148   getUserInfo( HASH )
149       Retrieves personal information for the user associated with the current
150       session.
151
152       user
153           A user ID
154
155   logout()
156       Ends the session for the logged-in user issuing the call. No arguments
157       are needed.  Useful to avoid hitting the limit of ten open sessions per
158       login.  Logout API Call
159       <http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_logout.htm>
160
161   query( HASH )
162       Executes a query against the specified object and returns data that
163       matches the specified criteria.
164
165       query
166           The query string to use for the query. The query string takes the
167           form of a basic SQL statement. For example, "SELECT Id,Name FROM
168           Account".
169
170       limit
171           This sets the batch size, or size of the result returned. This is
172           helpful in producing paginated results, or fetch small sets of data
173           at a time.
174
175   queryAll( HASH )
176       Executes a query against the specified object and returns data that
177       matches the specified criteria including archived and deleted objects.
178
179       query
180           The query string to use for the query. The query string takes the
181           form of a basic SQL statement. For example, "SELECT Id,Name FROM
182           Account".
183
184       limit
185           This sets the batch size, or size of the result returned. This is
186           helpful in producing paginated results, or fetch small sets of data
187           at a time.
188
189   queryMore( HASH )
190       Retrieves the next batch of objects from a "query" or "queryAll".
191
192       queryLocator
193           The handle or string returned by "query". This identifies the
194           result set and cursor for fetching the next set of rows from a
195           result set.
196
197       limit
198           This sets the batch size, or size of the result returned. This is
199           helpful in producing paginated results, or fetch small sets of data
200           at a time.
201
202   resetPassword( HASH )
203       Changes a user's password to a server-generated value.
204
205       userId
206           A user Id.
207
208   retrieve( HASH )
209       fields
210           A comma delimited list of field name you want retrieved.
211
212       type
213           The type of the object being queried.
214
215       ids The ids (LIST) of the object you want returned.
216
217   search( HASH )
218       searchString
219           The search string to be used in the query. For example, "find
220           {4159017000} in phone fields returning contact(id, phone,
221           firstname, lastname), lead(id, phone, firstname, lastname),
222           account(id, phone, name)"
223
224   setPassword( HASH )
225       Sets the specified user's password to the specified value.
226
227       userId
228           A user Id.
229
230       password
231           The new password to assign to the user identified by "userId".
232
233   sf_date
234       Converts a time in Epoch seconds to the date format that Salesforce
235       likes
236
237   update(type => $type, HASHREF [, HASHREF ...])
238       Updates one or more existing objects in your organization's data. This
239       subroutine takes as input a type value which names the type of object
240       to update (e.g. Account, User) and one or more perl HASH references
241       containing the fields (the keys of the hash) and the values of the
242       record that will be updated.
243
244       The hash must contain the 'Id' key in order to identify the record to
245       update.
246
247   upsert(type => $type, key => $key, HASHREF [, HASHREF ...])
248       Updates or inserts one or more objects in your organization's data.  If
249       the data doesn't exist on Salesforce, it will be inserted.  If it
250       already exists it will be updated.
251
252       This subroutine takes as input a type value which names the type of
253       object to update (e.g. Account, User).  It also takes a key value which
254       specifies the unique key Salesforce should use to determine if it needs
255       to update or insert.  If key is not given it will default to 'Id' which
256       is Salesforce's own internal unique ID.  This key can be any of
257       Salesforce's default fields or an custom field marked as an external
258       key.
259
260       Finally, this method takes one or more perl HASH references containing
261       the fields (the keys of the hash) and the values of the record that
262       will be updated.
263
264   describeMetadata()
265       Get some metadata info about your instance.
266
267   retrieveMetadata()
268   checkAsyncStatus( $pid )
269   checkRetrieveStatus( $pid )
270   getErrorDetails( RESULT )
271       Returns a hash with information about errors from API calls - only
272       useful if ($res->valueof('//success') ne 'true')
273
274         {
275             'statusCode' => 'INVALID_FIELD_FOR_INSERT_UPDATE',
276             'message' => 'Account: bad field names on insert/update call: type'
277             ...
278         }
279
280   bye()
281       Synonym for "logout".
282
283       Ends the session for the logged-in user issuing the call. No arguments
284       are needed.  Returns a reference to an array of hash refs
285
286   do_query( $query, [$limit] )
287       Returns a reference to an array of hash refs
288
289   do_queryAll( $query, [$limit] )
290       Returns a reference to an array of hash refs
291
292   get_field_list( $table_name )
293       Returns a ref to an array of hash refs for each field name Field name
294       keyed as 'name'
295
296   get_tables()
297       Returns a reference to an array of hash references Each hash gives the
298       properties for each Salesforce object
299

EXAMPLES

301   login()
302           use WWW::Salesforce;
303           my $sf = WWW::Salesforce->login( 'username' => $user,'password' => $pass )
304               or die $@;
305
306   search()
307           my $query = 'find {4159017000} in phone fields returning contact(id, phone, ';
308           $query .= 'firstname, lastname), lead(id, phone, firstname, lastname), ';
309           $query .= 'account(id, phone, name)';
310           my $result = $sforce->search( 'searchString' => $query );
311

SUPPORT

313       Please visit Salesforce.com's user/developer forums online for
314       assistance with this module. You are free to contact the author
315       directly if you are unable to resolve your issue online.
316

CAVEATS

318       The "describeSObjects" and "describeTabs" API calls are not yet
319       complete. These will be completed in future releases.
320
321       Not enough test cases built into the install yet.  More to be added.
322

SEE ALSO

324           L<DBD::Salesforce> by Jun Shimizu
325           L<SOAP::Lite> by Byrne Reese
326
327           Examples on Salesforce website:
328           L<http://www.sforce.com/us/docs/sforce70/wwhelp/wwhimpl/js/html/wwhelp.htm>
329

HISTORY

331       This Perl module was originally provided and presented as part of the
332       first Salesforce.com dreamForce conference on Nov. 11, 2003 in San
333       Francisco.
334

AUTHORS

336       Byrne Reese - <byrne at majordojo dot com>
337
338       Chase Whitener <capoeirab@cpan.org>
339
340       Fred Moyer <fred at redhotpenguin dot com>
341

CONTRIBUTORS

343       Michael Blanco
344
345       Garth Webb
346
347       Jun Shimizu
348
349       Ron Hess
350
351       Tony Stubblebine
352
354       Copyright 2003-2004 Byrne Reese, Chase Whitener, Fred Moyer. All rights
355       reserved.
356
357       This program is free software; you can redistribute it and/or modify it
358       under the same terms as Perl itself.
359
360
361
362perl v5.34.0                      2021-07-27                WWW::Salesforce(3)
Impressum