Query extension examples related to cases

This article describes complex queries using extensions that provide information related to the context of the currently selected case in Salesforce.

Similar cases

This query lists the most pertinent cases that share concepts and keywords from the subject of the currently selected case.

@objecttype==case
(NOT @sfid=="{!Id}")
$correlateResultSet(resultSet: @sfid=="{!Id}", field: "@sysconcepts", maximumValues: '25', modifier: '10000')
$correlateUsingIdf(keywords: "{!>Subject}")

In more details:

  • Line 1 gets all results that are of type case.

  • Line 2 excludes the currently selected case.

  • Line 3 uses the standard extension $correlateResultSet to create ranking expressions to boost cases with similar concepts.

  • Line 4 uses the standard extension $correlateUsingIdf to create ranking expressions to boost cases sharing keywords from the subject of the currently selected case.

This query lists the most pertinent knowledge base articles sharing concepts and keywords from the subject of the currently selected case.

@sfobjecttype=="KB Article"
$qre(expression: '@sfkbarticleresolution=(fix)', modifier: '40')
$correlateResultSet(resultSet: @sfid=="{!Id}", field: "@sysconcepts", maximumValues: '25', modifier: '10000')
$correlateUsingIdf(keywords: "{!>Subject}")

In more details:

  • Line 1 gets all results for which the Salesforce object type is KB Article.

  • Line 2 uses the standard extension $qre to create ranking expressions to boost articles with a resolution status set to fix.

  • Line 3 uses the standard extension $correlateResultSet to create ranking expressions to boost articles sharing concepts with the currently selected case.

  • Line 4 uses the standard extension $correlateUsingIdf to create ranking expressions to boost articles sharing keywords from the subject of the currently selected case.

This query lists the most pertinent community posts sharing concepts and keywords from the subject of the currently selected case.

@objecttype==answer
$correlateResultSet(resultSet: @sfid=="{!Id}", field: "@sysconcepts", maximumValues: '25', modifier: '10000')
$correlateUsingIdf(keywords: "{!>Subject}")

In more details:

  • Line 1 gets all results for which the Salesforce object type is answer, corresponding to Answers community posts.

  • Line 2 uses the standard extension $correlateResultSet to create ranking expressions to boost posts sharing concepts with the currently selected case.

  • Line 3 uses the standard extension $correlateUsingIdf to create ranking expressions to boost posts sharing keywords from the subject of the currently selected case.

This query lists the most pertinent Khoros Community developer community posts that share concepts and keywords from the subject of the currently selected case.

@sysfiletype==lithiummessage
$correlateResultSet(resultSet: @sfid=="{!Id}", field: "@sysconcepts", maximumValues: '25', modifier: '10000')
$correlateUsingIdf(keywords: "{!>Subject}")

In more details:

  • Line 1 gets all results for which the file type is lithiummessage, in this case, posts from a Khoros Community message board for developers.

  • Line 2 uses the standard extension $correlateResultSet to create ranking expressions to boost posts sharing concepts with the currently selected case.

  • Line 3 uses the standard extension $correlateUsingIdf to create ranking expressions to boost posts sharing keywords from the subject of the currently selected case.

This query lists the most pertinent files sharing concepts and keywords from the subject of the currently selected case.

$type(name:'File')
$correlateUsingIdf(keywords: '{!>Subject}')
$correlateResultSet(resultSet: @sfid=="{!Id}", field: '@sysconcepts', maximumValues: '25', modifier: '10000')

In more details:

  • Line 1 uses the standard extension $type to get only results that are files.

  • Line 2 uses the standard extension $correlateUsingIdf to create ranking expressions to boost files sharing keywords from the subject of the currently selected case.

  • Line 3 uses the standard extension $correlateResultSet to create ranking expressions to boost posts sharing concepts with the currently selected case.