@adriantombu/salesforce-convert-id
v1.0.4
Published
This library converts a 15 character Salesforce ID to a 18 characters Salesforce ID
Downloads
24
Maintainers
Readme
Salesforce Convert ID
Before the Salesforce API v2.5 we had both formats of ID lengths which can sometimes lead to some problems. This library aims to converts a 15 character Salesforce ID to a 18 characters Salesforce ID to address this issue.
How to use it
- Install the library first with
yarn add @adriantombu/salesforce-convert-id
- And then import it in your script
const { salesforceConvertId } = require('@adriantombu/salesforce-convert-id')
const smallId = 'a0i1t000002i0p0';
const longId = salesforceConvertId(smallId)
'a0i1t000002i0p0AAA'
In case of an invalid ID, we juste send it back with no warning as this is not the purpose of this library
const { salesforceConvertId } = require('@adriantombu/salesforce-convert-id')
const aWrongId = 'badid';
const longId = salesforceConvertId(aWrongId)
'badid'
How to contribute
- Clone the repository
git clone [email protected]:adriantombu/salesforce-convert-id.git
- Install the packages with
yarn install
- Modify the
src/index.ts
file - When everything's done, you can send a PR \o/