top of page
OmniStudioFactBg.png
Writer's picturePalem Ravi Kiran Reddy

Using SOQL Query in DataRaptor Formula

We can execute a SOQL query in the Dataraptor formula by using the QUERY function. But it can only retrieve up to one column. Let's see a few examples of using it:

  • Passing a static value

QUERY ("SELECT Name FROM Account WHERE BillingState ='CA'")
  • Querying with a single dynamic value

QUERY( "SELECT AccountId FROM User WHERE Id = '{0}'",$Vlocity.UserId )

  • Querying with multiple dynamic values

QUERY ( "SELECT Id FROM Account WHERE RecordType.DeveloperName = 'Member' And LastName Like '{0}' And FirstName Like '{1}' And DateOfBirth__pc = {2} And Phone = '{3}' ", lastNameToSearch, firstNameToSearch, formattedDate, Phone)

  • Similarly, we have a CountQuery function that returns the number of records returned

	COUNTQUERY ( "SELECT COUNT() FROM Case WHERE AccountId = '{0}'" , Id)



Considerations :

1. To use the Like operator in the query we have to form the string in the below format and use this concatenated value in the Query.


2. To Query with the date field, the dynamic notation should not have quotes i.e., instead of ‘{1}’ use {1}. For example, DateOfBirth__pc = {1}




References:


612 views0 comments

Recent Posts

See All

OmniscriptBaseMixin Methods

Enable a custom Lightning web component to interact with OmniScript by extending the OmniScriptBaseMixin component. The...

Comments


bottom of page