0.4.0 • Published 6 years ago

salesforce-metadata-xml-builder v0.4.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Usage

const AdmZip = require('adm-zip');
const jsforce = require('jsforce');
const metadata = require('salesforce-metadata-xml-builder');

const objectxml = metadata.CustomObject({
  fullName: 'TestObject__c',
  label: 'TestObject',
  pluralLabel: 'TestObject',
  nameField: {
    type: 'AutoNumber',
    fullName: 'Name',
    label: 'Name'
  },
  deploymentStatus: 'Deployed',
  sharingModel: 'ReadWrite'
});
const packagexml = metadata.Package({
  types: [{
    name: 'CustomObject', members: ['TestObject__c']
  }],
  version: '35.0'
});

const zip = new AdmZip();
zip.addFile("src/package.xml", new Buffer(packagexml));
zip.addFile("src/objects/TestObject__c.object", new Buffer(objectXml));

const conn = new jsforce.Connection();
conn
  .login('yourusername@example.com', 'yourpassword')
  .then(() => {
    return conn.metadata.deploy(zip.toBuffer()).complete({ details: true });
  })
  .then((res) => {
    console.log(res);
  })

How to build

  1. Download metadata wsdl file from your organization, and place as ./metadata.xml
  2. npm run build
0.4.0

6 years ago

0.3.0

7 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago