salesforce-query-builder
v1.0.2
Published
QueryBuilder- (soql)(@SalesForce)
Downloads
7
Maintainers
Readme
SalesForce Query Builder
Installation
npm i salesforce-query-builder
Simple example of QueryBuilder:
new SFQuery('Contact')
.select(['Id', 'Name'])
.where("Name != null")
.whereIn('Name', ['Maria', 'Ana'])
.limit(3)
.build()
SELECT
Id,
Name
FROM Contact
WHERE Name != null AND Name IN ('Maria','Ana')
LIMIT 3
new SFQuery('Contact')
.select([ 'Name'])
.groupBy("Name")
.build()
SELECT
Name
FROM Contact
GROUP BY Name
new SFQuery('Contact')
.select([ 'Name'])
.offset(10)
.limit(20)
.build()
SELECT
Name
FROM Contact
OFFSET 10 LIMIT 20
Relationship example of QueryBuilder:
new SFQuery('Contact')
.select(['Id', 'Name','Account__r.Name'])
.where("Name != null")
.whereIn('Name', ['Maria', 'Ana'])
.orderBy('Name', 'DESC')
.limit(3)
.build()
SELECT
Id,
Name,
Account__r.Name
FROM Contact
WHERE Name != null AND Name IN ('Maria','Ana')
ORDER BY Name DESC
LIMIT 3
EncodeQueryUrl example of QueryBuilder:
encodeQueryUrl(
new SFQuery("Contact")
.select(["Id", "Name"])
.where("Name != null")
.limit(3)
.build()
);
("query/?q=SELECT+Id,Name+FROM+Contact+WHERE+Name+!=+null+LIMIT+3");