The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

DESCRIPTION

This class provides a simple abstraction layer between SOAP::Lite and Salesforce.com. Because SOAP::Lite does not support complexTypes, and document/literal encoding is limited, this module works around those limitations and provides a more intuitive interface a developer can interact with.

METHODS

login( HASH )

The login method returns a 1 if the login attempt was successful, and 0 otherwise. Upon a successful login, the sessionId is saved and the serverUrl set properly so that developers need not worry about setting these values manually.

The following are the accepted input parameters:

username

A Salesforce.com username.

password

The password for the user indicated by username.

query( HASH )

Executes a query against the specified object and returns data that matches the specified criteria.

query

The query string to use for the query. The query string takes the form of a basic SQL statement. For example, "SELECT Id,Name FROM Account".

See also: http://www.sforce.com/us/docs/sforce40/sforce_API_calls_SOQL.html#wp1452841

limit

This sets the batch size, or size of the result returned. This is helpful in producing paginated results, or fetch small sets of data at a time.

queryMore( HASH )

Retrieves the next batch of objects from a query.

queryLocator

The handle or string returned by query. This identifies the result set and cursor for fetching the next set of rows from a result set.

limit

This sets the batch size, or size of the result returned. This is helpful in producing paginated results, or fetch small sets of data at a time.

update( HASH )

Updates one or more existing objects in your organization's data. This subroutine takes as input a single perl HASH containing the fields (the keys of the hash) and the values of the record that will be updated.

The hash must contain the 'Id' key in order to identify the record to update.

create( HASH )

Adds one or more new individual objects to your organization's data. This takes as input a HASH containing the fields (the keys of the hash) and the values of the record you wish to add to your arganization.

The hash must contain the 'Type' key in order to identify the type of the record to add.

delete( ARRAY )

Deletes one or more individual objects from your organization's data. This subroutine takes as input an array of SCALAR values, where each SCALAR is an sObjectId.

getServerTimestamp()

Retrieves the current system timestamp (GMT) from the sforce Web service.

getUserInfo( HASH )

Retrieves personal information for the user associated with the current session.

user

A user ID

getUpdated( HASH )

Retrieves the list of individual objects that have been updated (added or changed) within the given timespan for the specified object.

type

Identifies the type of the object you wish to find updates for.

start

A string identifying the start date/time for the query

end

A string identifying the end date/time for the query

getDeleted( HASH )

Retrieves the list of individual objects that have been deleted within the given timespan for the specified object.

type

Identifies the type of the object you wish to find deletions for.

start

A string identifying the start date/time for the query

end

A string identifying the end date/time for the query

describeSObject( HASH )

Describes metadata (field list and object properties) for the specified object.

type

The type of the object you wish to have described.

describeGlobal()

Retrieves a list of available objects for your organization's data.

setPassword( HASH )

Sets the specified user's password to the specified value.

userId

A user Id.

password

The new password to assign to the user identified by userId.

resetPassword( HASH )

Changes a user's password to a server-generated value.

userId

A user Id.

retrieve( HASH )
fields

A comma delimitted list of field name you want retrieved.

type

The type of the object being queried.

id

The id of the object you want returned.

search( HASH )
searchString

The search string to be used in the query. For example, "find {4159017000} in phone fields returning contact(id, phone, firstname, lastname), lead(id, phone, firstname, lastname), account(id, phone, name)"

EXAMPLES

login()

    use Salesforce;
    my $service = new Salesforce::SforceService;
    my $port = $service->get_port_binding('Soap');
    $port->login('username' => $user,'password' => $pass)
       || die "Could not login to salesforce.com";

search()

    my $service = new Salesforce::SforceService;
    my $port = $service->get_port_binding('Soap');
    my $result = $port->login('username' => $user, 'password' => $pass);
    $result = $port->search('searchString' => 'find {4159017000} in phone fields returning contact(id, phone, firstname, lastname), lead(id, phone, firstname, lastname), account(id, phone, name)');

SUPPORT

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

AUTHORS

Byrne Reese <byrne at majordojo dot com>

COPYRIGHT

Copyright 2003-2004 Byrne Reese. All rights reserved.