soql – How to add another query to Lead object? node.js function
I have a function that fetches a contact record in Salesforce, how to add one more query to check if there are records with the phone in the Lead object?
my function
return got(`${token.instance_url}/services/data/v41.0/query/`, {
headers: options,
query:
'q=' +
encodeURIComponent(
`SELECT Id, Name from Contact WHERE Phone="${event.from}"` //Include Lead object query
)
});
})
.then(response => {
const attributes = JSON.parse(response.body);
console.log(`found: ${attributes.records.length} records`);
if (attributes.records.length !== 0) {
callback(null, {
name: attributes.records[0].Name,
id: attributes.records[0].Id
});
} else {
after that I’ll check which object returns the record (if any).
Read more here: Source link