Vlocity Facts #38 || DataMapper Extract - Filter Conditions and Functions
Data Mapper Extract is used to fetch the records from salesforce. We can extract multiple object records based on conditions and filters. Will discuss some scenarios in this post.
1. Consider when we need to extract all the accounts, we can use '$Vlocity.NULL' in filter condition to get all the accounts.
2. By using Order By we can filter the records and we can use DESC or ASC. By default records will be displayed in Ascending order. To display in Descending order use DESC in filter condition. Note: Give space between the filed name and DESC/ASC
3. By using Offset we can skip the first N numbers of records while we are extracting. Offset we can use in Pagination scenarios. For more details refer this DataRaptor Offset Filter.
4. We can fetch the contacts based on the Account fields in singe extract step with out creating multiple steps. Consider i need to extract Contacts which are related to Industry - Energy of Accounts.
Note: Use dot notation[.] for standard objects Account.Industry, for custom objects use __r. Order__r.Status.
5. By using And, OR filters we can extract the records based on the conditions. Consider this SOQL query.
Select Id,Name,Active__c,AnnualRevenue,Industry from Account Where (LastModifiedDate != TODAY OR Active__c ='Yes' ) AND (AnnualRevenue != null OR Industry ='Energy').
a. We can build our Data Mapper Extract with same conditions.
b. Limitation of DR is we cannot use brackets directly so we need to follow in this way to get the same out put.
a. For Account object --> Account is the path
b. For Opportunity Object --> Account:Opportunity is the path
Both paths of Json will be displayed once we enable Show all sObjects Fields.
Comments
Post a Comment