0

This below code results in INVALID_FIELD: Test' AND ParentId = null AND EndDate > '2019-05-21' LIMIT 1 error.. How can I add more than one condition in where clasue?

const a = 2019-01-03
const b = 2019-02-03

connection.sobject('Campaign')
.find({
  Type: { $eq: 'Test' },
  ParentId: { $eq: null },
  EndDate: {
     $gt: a,
     $lt: b,
  }
})
.limit(1)
.then(data => {
  console.log(data);
})
1

You can set your WHERE-clause as a string in JSForce:

connection.sobject('Campaign')
.where('Type = \'Test\' AND ParentID = NULL AND EndDate > ' + a + ' AND EndDate < ' + b)
.limit(1)
.then(data => {
  console.log(data);
})

See: https://jsforce.github.io/jsforce/doc/Query.html#where

  • Thank you so much! It worked! – il0v3d0g May 23 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.