Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 7 Next »

5.0.0

The ApptSearch object is part of the overall ServiceBroker Configuration object, in the following location:

An ApptSearch object is used within the context of a REST Objects Modules (itself part of an REST Objects Configuration) to represent how ServiceBroker should search for appointment offerings from the configured Providers, for the relevant tenant.


When the REST Work Item Appointment Search is used to search for appointment offerings, the tenant's AppSearch object properties controls how the search is performed for the relevant tenant, using the valid, enabled sub-system integrations that the tenant has enabled. 

The appointment offerings search is controlled for the tenant in the following way:

  • Firstly, any SearchRules defined are evaluated in order, and at the first matching rule, all defined Providers for that rule are searched for appointments.
  • If there are no matching SearchRules (or if none are defined) then:
    • If the PreferredProvider is set, then:
      • The Provider specified as preferred will be searched first.
      • If appointment offerings can be found from the preferred Provider, then only these results will be returned - no further configured Providers will be searched.
      • Otherwise, if no appointment offerings can be found from the preferred Provider, then all remaining Providers defined by the Providers value will be searched, and all appointment offerings found (if any) will be returned.
    • If the PreferredProvider is not set, then:
      • All Providers defined by the Providers value will be searched, and all appointment offerings found (if any) will be returned.

In addition the TransformIn property can be used to set default search object values that should be used for all appointment offering searches in the appropriate sub-system integrations for the relevant tenant.

ApptSearch Object Format

JSON Format
{
	"Providers": [
    	"",
		"",
		...
	],
	"PreferredProvider": "",
	"SearchRules": [
		{
			"Enabled": true,
			"Name": "",
			"Rules": [
				{
					"Type": "Any",
					"Matches": [
						"",
						""
						...
					]
				},
				{
					"Type": "All",
					"Matches": [
						"",
						""
						...
					]
				},
				{
					"Type": "DataSet",
					"Params": {
						"Id": ""
						"Op": ""
						"Value": ""
					}
				},
				...
			],
			"Outcomes": [
				"Providers": [
					"",
					"",
					...
				]
			]
		},
		...
	],
	"TransformIn": {
		"SD": {},
		"SS": {}
	},
	"MaxOffers": 10
}

ApptSearch Object Properties

 

PropertyTypeRequired?Description
ProvidersarrayYes

An array of strings, defining which configured Providers should be used when searching for appointment offerings when not directed to specific Providers via a matching SearchRules value, for the relevant tenant.

See the description above which explains when and how the Providers value is used.

Supported values:

  • SD: When set, a search for appointments can be performed in an integrated ServiceDispatch sub-system, when required. If the SD value is set here, this requires that an OPS provider object has been set for the tenant with a valid, enabled ServiceDispatch integration.
  • SS: When set, a search for appointments can be performed in an integrated ServiceScheduling sub-system, when required. If the SS value is set here, this requires that a Scheduler provider object has been set for the tenant with a valid, enabled ServiceScheduling integration.
PreferredProviderstringYes

A string, defining which of the configured Providers values should be used as the preferred Provider, for the relevant tenant.

See the description above which explains when and how the PreferredProvider value is used.

When null, no preferred Provider is configured for the tenant.

Supported values:

  • SD: When set, ServiceDispatch will be used as the preferred Provider. If set, this requires that SD be present in the Providers array, and that an OPS provider object has been set for the tenant with a valid, enabled ServiceDispatch integration.
  • SS: When set, ServiceScheduling will be used as the preferred Provider, If set, this requires that SS be present in the Providers array, and that Scheduler provider object has been set for the tenant with a valid, enabled ServiceScheduling integration.
SearchRulesarrayNo

An array of SearchRules, which are evaluated in order.

If no SearchRules are required, the SearchRules object may be omitted.

(info) See below for a SearchRules example.

 EnabledbooleanYesIs the SearchRule enabled? When false, the SearchRule will be skipped, and not evaluated.
 NamestringYesA string describing the SearchRule, to assist with managing SearchRules.
 RulesarrayYesAn array of one or more rules for the SearchRule. All of the rules defined in the SearchRule need to match for the overall SearchRule to match (i.e. logical AND evaluation).
  TypeenumYes

One of three defined string values, which determines how the rule should be evaluated.

Supported values:

  • Any: When the Type is Any, then if any one of the matches in the Matches array matches, then the rule matches (i.e. logical OR evaluation).
  • All: When the Type is All, then all of the matches in the Matches array need to match, for the rule to match (i.e. logical AND evaluation).
  • DataSet: When the Type is DataSet, then if the match in the Params object matches, then the rule matches.
  MatchesarrayNo

An array of one or more matches to be used when evaluating the rule, when the Type of the rule is either Any or All.

Required when the Type of the rule is either Any or All.

Each match is a JsonPath filter, which is evaluated against the search object supplied via the REST Work Item Appointment Search.

  ParamsobjectNo

An object defining the match to be used when evaluating the rule, when the Type of the rule is either DataSet.

Required when the Type of the rule is DataSet.

   IdstringYes

The Id of a data set, defined via the Data Set API, which must already exist in ServiceBroker for the relevant tenant.

   OpenumYes

A string defining the relationship between the Value and the data set.

  • In: The rule will match when the Value is in the data set.
  • Out: The rule will match when the Value is not in the data set.
   ValuestringYes

The field of the search object supplied via the REST Work Item Appointment Search which should be compared with the data set.

 OutcomeobjectYesAn object defining the outcome of what should be done when the overall rule matches. Currently the only supported outcome is a Providers array.
  ProvidersarrayYes

An array defining the Providers that the appointment search should be sent to when the overall rule matches. The array must contain one or more strings, defining which Provider or Providers to send the appointment search to.

Supported values:

  • SD: When set, the appointment search will be sent to ServiceDispatch. If set, this requires that an OPS provider object has been set for the tenant with a valid, enabled ServiceDispatch integration.
  • SS: When set, the appointment search will be sent to ServiceScheduling. If set, this requires that a Scheduler provider object has been set for the tenant with a valid, enabled ServiceScheduling integration.
TransformInobjectYes

An object, containing both an SD and a SS sub-object.

The SD sub-object defines any default search object values which should be added to the search object supplied via the REST Work Item Appointment Search call, at the point immediately before the search is made to the ServiceDispatch sub-system, for the relevant tenant.

The SS sub-object defines any default search object values which should be added to the search object supplied via the REST Work Item Appointment Search call, at the point immediately before the search is made to the ServiceScheduling sub-system, for the relevant tenant.

  • If the search object supplied via the REST Work Item Appointment Search already contains a value defined in the TransformIn object, then the value from the API call will be used. Property values defined in the TransformIn object are only added when the property does not already exist.
  • Property values are added to the search object only immediately before the object is sent to the relevant sub-system. As a result, property values from the TransformIn object cannot be used in the evaluation of SearchRules.

Where no default search object values should be added to the search object, the relevant sub-object should be an empty object - for example:

"TransformIn": {
	"SD": {},
	"SS": {}
}

As an example where default search object values are to be set:

"TransformIn": {
	"SD": {
		"WorkType": {
			"Name": "WORK_TYPE"
		},
		"Location": {
			"Postcode": "12345",
			"Country": "USA"
		},
		"Product": {
			"BrandCode": "CODE_1",
			"ProductCode": "PROD_1"
		}
	},
	"SS": {
		"WorkType": {
			"Name": "WORK_TYPE"
		}
	}
}

With the above TransformIn value set in a tenant's AppSearch object:

  • Any searches for appointment offerings sent from ServiceBroker to the configured ServiceDispatch sub-system for the tenant would have the following search object property/values added, whenever there was not an already existing property value set:
    • WorkType > Name: WORK_TYPE
    • Location > Postcode: 12345
    • Location > Country: USA
    • Product > BrandCode: CODE_1
    • Product > ProductCode: PROD_1
  • Any searches for appointment offerings sent from ServiceBroker to the configured ServiceScheduling sub-system for the tenant would have the following search object property/values added, whenever there was not an already existing property value set:
    • WorkType > Name: WORK_TYPE

SearchRules Examples

For the examples below, assume that the tenant has created a ZIP_CODES data set containing the following values:

12345
12346
12347

Also assume that the SearchRules value of the tenant's ApptSearch object is:

"SearchRules": [
	{
		"Enabled": false,
		"Name": "Send ZIP_CODES to SS - Disabled",
		"Rules": [
			{
				"Type": "DataSet",
				"Params": {
					"Id": "ZIP_CODES",
					"Op": "In",
					"Value": "$.Location.Postcode"
				}
			}
		],
		"Outcome": {
			"Providers": [
				"SS"
			]
		}
	},
	{
		"Enabled": true,
		"Name": "Send ZIP_CODES to SD",
		"Rules": [
			{
				"Type": "DataSet",
				"Params": {
					"Id": "ZIP_CODES",
					"Op": "In",
					"Value": "$.Location.Postcode"
				}
			}
		],
		"Outcome": {
			"Providers": [
				"SD"
			]
		}
	},
	{
		"Enabled": true,
		"Name": "Send WORK_TYPE_1 & WORK_TYPE_2 + CODE_1/BRAND_1 to SS",
		"Rules": [
			{
				"Type": "Any",
				"Matches": [
					"$[?(@.WorkType.Name=='WORK_TYPE_1')]",
					"$[?(@.WorkType.Name=='WORK_TYPE_2')]"
				}
			},
			{
				"Type": "All",
				"Matches": [
					"$[?(@.Product.BrandCode=='BRAND_1')]",
					"$[?(@.Product.ProductCode=='PRODUCT_1')]"				}
			}
		],
		"Outcome": {
			"Providers": [
				"SS"
			]
		}
	}
]

Example #1

For this example, assume that the search object provided via the REST Work Item Appointment Search contains the following data (this is not a complete object - it only contains the relevant data for the purposes of evaluating the SearchRules):

{
	"Location": {
		"Postcode": 12346
	},
	"Product": {
		"BrandCode": "BRAND_1",
		"ProductCode": "PRODUCT_1"
	},
	"WorkType": {
		"Name": "WORK_TYPE_1"
	}
}

For this example:

  • The first SearchRule has Enabled set to false, therefore the first rule is not evaluated.
  • The second SearchRule matches when:
    • the Location > Postcode value of the search object is in the ZIP_CODES data set. 
  • The search object matches this condition.
    • Therefore, this SearchRule matches, and the outcome will be that this appointment search will be sent to ServiceDispatch.

Example #2

For this example, assume that the search object provided via the REST Work Item Appointment Search contains the following data (this is not a complete object - it only contains the relevant data for the purposes of evaluating the SearchRules):

{
	"Location": {
		"Postcode": 12348
	},
	"Product": {
		"BrandCode": "BRAND_1",
		"ProductCode": "PRODUCT_1"
	},
	"WorkType": {
		"Name": "WORK_TYPE_1"
	}
}

For this example:

  • The first SearchRule has Enabled set to false, therefore the first rule is not evaluated.
  • The second SearchRule matches when:
    • the Location > Postcode value of the search object is in the ZIP_CODES data set. 
  • The search object has a Location > Postcode value of 12348, which is not in the ZIP_CODES data set.
    • Therefore, the second SearchRule does not match.
  • The third SearchRule matches when:
    • the WorkType > Name value is either WORK_TYPE_1 or WORK_TYPE_2; and
    • the Product > Brand Code value is BRAND_1 and the Product > Product Code value is PRODUCT_1.
  •  The search object matches this condition.
    • Therefore, this SearchRule matches, and the outcome will be that this appointment search will be sent to ServiceScheduling.

Example #3

For this example, assume that the search object provided via the REST Work Item Appointment Search contains the following data (this is not a complete object - it only contains the relevant data for the purposes of evaluating the SearchRules):

{
	"Location": {
		"Postcode": 12348
	},
	"Product": {
		"BrandCode": "BRAND_1",
		"ProductCode": "PRODUCT_2"
	},
	"WorkType": {
		"Name": "WORK_TYPE_1"
	}
}

For this example:

  • The first SearchRule has Enabled set to false, therefore the first rule is not evaluated.
  • The second SearchRule matches when:
    • the Location > Postcode value of the search object is in the ZIP_CODES data set. 
  • The search object has a Location > Postcode value of 12348, which is not in the ZIP_CODES data set.
    • Therefore, the second SearchRule does not match.
  • The third SearchRule matches when:
    • the WorkType > Name value is either WORK_TYPE_1 or WORK_TYPE_2and
    • the Product > Brand Code value is BRAND_1 and the Product > Product Code value is PRODUCT_1.
  •  The search object has a Product > Brand Code value of BRAND_2, which means that the All requirement of the second part of the rules does not match.
    • Therefore third SearchRule does not match.

As a result, none of the SearchRules match.

Therefore, the appointment search will be sent as configured based on the tenant's ApptSearch Providers and PreferredProvider values.

  • No labels