# List of conditions by which email templates are available in the email composer template dropdown list.
# The rule set COLLECTS all conditions that evealute to TRUE.
# The name of the email template must be exactly like the template name in the conve view configuration wizard, but it is not case-sensitive.
# This is an optional document in the config set: if exists, the filter is applied on the email template dropdown list to show only relevant templates, otherwise the dropdown list shows all the email templates.
##############################################

kind: ruleSet
metadata:
  name: case-management/v1/email-template-filter
spec:
  nodes:
  - if: 'wf.variables["CustomerType"]= "Cloud Customer"'
    then:
      emailTemplateList: ['template1','template2','template3',...] # array of email template names
      defaultTemplateName: 'template1' # if rule is TRUE, then apply this template by default
      defaultTemplateMode: 'Body'
  - if: 'wf.variables["CustomerType"]= "Legacy Customer"'
    then:
      emailTemplateList: ['template11','template12','template13',...] # array of email template names
      defaultTemplateName: 'template11' # if rule is TRUE, then apply this template by default
      defaultTemplateMode: 'BodyAndSubject'
  - if: 'IndexOf(wf.variables["scmCaseTitle"], "urgent") > 0'
    then:
      emailTemplateList: ['template4','template5','template6',...] # array of email template names
      defaultTemplate: '' # if rule is TRUE, then do not apply any template by default
 - if: 'wf.variables["LineOfBusiness"] in ("S2P", "AP", "R2R")'
    then:
      emailTemplateList: ['template1','template21','template31',...] # array of email template names
      # if rule is TRUE and default template is not configred, then do not apply any template by default
  - if: 'wf.variables["Category"]= "Cloud Customer" AND wf.variables["Type"]= "Request" AND wf.variables["SubType"]= "License"'
    then:
      emailTemplateList: ['template1','template2','template3',...] # array of email template names
      defaultTemplate: 'oopsTypo' # if rule is TRUE and template name does not exist, then do not apply any template by default      
      defaultTemplateMode: 'BodyAndSubject'