salesforce.srecord
Home > @runlightyear/salesforce > SRecord
SRecord type
Signature:declare type SRecord = {
id: string;
attributes: Attributes;
[fieldName: string]: any;
};
Example 1
Get a lead
const response = await salesforce.getRecord({
objectType: "Lead",
objectId: "00QDo000005arNKMAY",
fields: ["name", "company"],
});
const lead = response.data;
console.log(`Got lead: ${lead.name} at ${lead.company}`);
Example 2
Get a list of accounts
const response = await salesforce.query({
q: `SELECT name FROM Account`,
});
const accounts = response.data.records;
console.log(accounts.map(account => account.name));