The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::SFDC::Role::CRUD - Shared methods between partner and tooling APIs

VERSION

version 0.37

DESCRIPTION

WWW::SFDC::Role::CRUD provides standard SObject manipulation methods which are shared between the Partner and Tooling APIs.

METHODS

query

If the query() API call is incomplete and returns a queryLocator, this library will continue calling queryMore() until there are no more records to recieve, at which point it will return the entire list:

  say $_->{Id} for WWW::SFDC->new(...)->Partner->query($queryString);

OR:

Execute a callback for each batch returned as part of a query. Useful for reducing memory usage and increasing efficiency handling huge queries:

  WWW::SFDC->new(...)->Partner->query({
    query => $queryString,
    callback => \&myMethod
  });

This will return the result of the last call to &myMethod.

queryAll

This has the same additional behaviour as query().

create

  say "$$_{id}:\t$$_{success}" for WWW::SFDC->new(...)->Partner->create(
    {type => 'thing', Field__c => 'bar', Name => 'baz'}
    {type => 'otherthing', Field__c => 'bas', Name => 'bat'}
  );

Create chunks your SObjects into 200s before calling create(). This means that if you have more than 200 objects, you will incur multiple API calls.

update

  say "$$_{id}:\t$$_{success}" for WWW::SFDC::Partner->instance()->update(
    {type => 'thing', Id => 'foo', Field__c => 'bar', Name => 'baz'}
    {type => 'otherthing', Id => 'bam', Field__c => 'bas', Name => 'bat'}
  );

Returns an array that looks like [{success => 1, id => 'id'}, {}...] with LOWERCASE keys.

delete

  say "$$_{id}:\t$$_{success}" for WWW::SFDC::Partner->instance()->delete(@ids);

Returns an array that looks like [{success => 1, id => 'id'}, {}...] with LOWERCASE keys.

undelete

  say "$$_{id}:\t$$_{success}" for WWW::SFDC::Partner->instance()->undelete(@ids);

Returns an array that looks like [{success => 1, id => 'id'}, {}...] with LOWERCASE keys.

retrieve

Retrieves SObjects by ID. Not to be confused with the metadata retrieve method.

describeGlobal

Lists SObjects available through this API.

describeSObjects

Unimplemented

BUGS

Please report any bugs or feature requests at https://github.com/sophos/WWW-SFDC/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::SFDC::Role::CRUD

You can also look for information at https://github.com/sophos/WWW-SFDC

AUTHOR

Alexander Brett <alexander.brett@sophos.com> http://alexander-brett.co.uk

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Sophos Limited https://www.sophos.com/.

This is free software, licensed under:

  The MIT (X11) License

The full text of the license can be found in the LICENSE file included with this distribution.