npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sf-bulk-jobs

v1.1.0

Published

## Why?

Downloads

5

Readme

Salesforce Bulk Job Tool

Why?

Salesforce Bulk API 2.0 allows developers to import large volumes of data through an asychronous process. The overall status of these jobs can be monitored through Salesforce's setup menu under the "Bulk Data Load Jobs" section.

Unfortunately, the setup menu does not allow users to view specific details about failed records when using the Bulk API 2.0. This is a simple command-line tool that allows us to retrieve and report on errors from the Bulk API 2.0.

How?

This tool leverages the Salesforce CLI to authenticate with Salesforce's APIs. See: https://developer.salesforce.com/tools/salesforcecli

Once authenticated, we are able to fetch detailed job status and specific errors through the API directly, through the various APIs provided by Salesforce:

What?

This is a simple Javascript command-line tool that provides the ability to extract and report on Bulk API 2.0 errors and export them to CSV or JSON formats.

Installation

Install dependencies

First, install the Salesforce CLI tool and node.js:

Next, open a terminal (Mac/Linux) or command prompt (Windows), use the following command to install the bulk-jobs tool from NPM:

npm install -g sf-bulk-jobs

Authenticate your org

Open a terminal or command prompt and authenticate your Salseforce org:

sf org login web -r https://yourorg.my.salesforce.com

Replace the value of https://yourorg.my.salesforce.com above with the appropriate instance URL of your org in the following format:

  • For production orgs: https://<my_domain_name>.my.salesforce.com
  • For sandbox orgs: https://<my_domain_name>--<sandbox_name>.sandbox.my.salesforce.com

This command will launch a browser for you to complete the authentication process.

Usage

The overall usage is as follows:

bulk-jobs [email protected]

Replace the value of [email protected] above with the username of the org that you would like to use. Note that you must complete the steps in the Installation section above to authenticate your org.

By default, the status of all completed Bulk v2.0 jobs from the current day will be displayed.

Options

The tool supports a variety of options. You may also view the built-in help:

bulk-jobs --help

The tool supports the following command-line options:

  • --help: Displays help text and usage information
  • --version: Displays the version of the tool
  • -i, --ids: Export specific job IDs
  • -d, --date: Export jobs for a specific date
  • -m, --mode: Choose to export jobs or errors
  • -f, --format: Choose between csv or json output formats
  • -o, --output: Write exported data into a file

Export Specific Job IDs

To export a specific job ID, use the -i flag:

bulk-jobs [email protected] -i 750W4000003R25dIAC

You may also specify multiple job IDs:

bulk-jobs [email protected] -i 750W4000003R25dIAC 750W4000003R5t7IAC

If this option is specified at the same time as -d or --date, then the provided date parameter will be ignored.

Export to CSV

Use the -f flag to set the format to CSV:

bulk-jobs [email protected] -f csv

This allows the options of:

  • json: The default. Exports to JSON format.
  • csv: Exports to CSV format.

Export to a File

Use the -o flag to specify an output file. If this option is not specified, results will be written to your terminal's standard output.

bulk-jobs [email protected] -f csv -o jobs.csv

Export Error Details

Use the -m option to control the export mode:

bulk-jobs [email protected] -f csv -m errors

This allows the options of:

  • jobs: The default. Provides a summary of jobs including total records processed and total number of errors
  • errors: Provides a detailed export of all errors for the jobs.

Export Results for a Specific Date

Use the -d option to specify a date:

bulk-jobs [email protected] -d 2024-06-26

The date provided must be in ISO format (yyyy-mm-dd), or today. The default is today.