Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The main query returns the ID of the Vonage Contact Center agent who owns the first case.

SOQL query

Data sources


Code Block
languagesql
themeEclipse
SELECT NVMContactWorld__NVM_Agent_Id__c
FROM User
WHERE Id IN
(
    SELECT OwnerId
    FROM Case          
    WHERE contactID = '$(Contact|ID)'
) LIMIT 1


User|NVM Agent Id

...

Using the contact's id, which you have previously retrieved and stored in an existing data source, the SOQL query returns the number of unique open cases.

SOQL query

Data sources


Code Block
languagesql
themeEclipse
SELECT COUNT_DISTINCT(CaseNumber)
FROM Case
WHERE
	Contact.Id = '$(Contact|Id)' AND
	Status != 'Closed'


Case|Case Number|Count Distinct

...

Using the account name, which you have previously retrieved and stored in an existing data source, the SOQL query returns the average time to resolve a case for the account in the last quarter.

SOQL query

Data sources


Code Block
languagesql
themeEclipse
SELECT AVG(Amount)
FROM Opportunity
WHERE
	Account.Id='$(Account|Id)'


Opportunity|Amount|Avg

Using a lead's ID to get the owner of the most recent activity

...

Using the agent's CLID, the SOQL returns the account ID for the first matching account. The subquery returns the opportunity opportunity ID and name for the most recently created opportunity related to the matching account.

SOQL queryData sources


Code Block
languagesql
themeEclipse
SELECT Id,(Select Name, id FROM Opportunities order by CreatedDate desc Limit 1) 
FROM Account 
WHERE Phone ='$(CLID)' 
Limit 1


Account.Opportunities|Name

Account.Opportunities|Opportunity ID

Account|Account ID

Using the entered number to locate a case or other record (using contains)

The SOQL returns the case ID of the first case located with a reference number that contains the entered number.

SOQL queryData sources


Code Block
languagesql
themeEclipse
SELECT ID
FROM Case
WHERE Reference_Number__c like '%$(EnteredNumber)%'
LIMIT 1


Case|Case ID