Salesforce Lookups
The Salesforce connector also allows you to lookup values from your organisation. The CustomLookup function is very similar to the native Lookup function in IMan.
Syntax
CustomLookup(systemid, select, from, where, "", mustreturnvalue)
Arguments
- systemid
- The system id value of the system connector to be used for the lookup.
- select
- The name of the field to be returned.
- from
- The name of the object to return the field from.
- where
- The where clause of the query, see the SOQL section for syntax.
- emptystring
- This parameter is not used, just pass an empty string.
- mustreturnvalue
- True or False to specify the Lookup query should return one record.
- True
- An error will be raised if the lookup fails to return a record.
- False
- The function will return an empty string if the lookup fails to return a record.
Example #1
To return the AccountNumber from the Account object using their email address as criteria. Note: Account_Email__c here is a custom field.
CustomLookup("SF", "AccountNumber", "Account", "Type = 'Customer' AND Account_Email__c = '[email protected]'", "", True)
The email address could have been replaced by an Expando field, this would read from a field in your data and replace the value for each line.
CustomLookup("SF", "AccountNumber", "Account", "Type = 'Customer' AND Account_Email__c = '%[Email]'", "", True)
Example #2
To return the SKU by using the Description and Currency as filters.
CustomLookup("SF", "SKU", "Product2", "PriceBookEntries.Description = 'Pen and Pencil Set' AND PriceBookEntries.PriceBook2.CurrencyISOCode = 'GBP'", True)
The dotted notation in the where queries allows you to navigate object relationships. In this example the product is a member of more than one PriceBook, where the PriceBookEntry is filtered on the PriceBook currency type.