<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<contentHaul xmlns:a="http://www.appian.com/ae/types/2009">
    <rule>
        <name>${interface_taskReport_sendTask_name}</name>
        <uuid>${interface_taskReport_sendTask_uuid}</uuid>
        <description>${interface_taskReport_sendTask_desc}</description>
        <parentUuid>${folder_rulesAndConstants}</parentUuid>
        <visibility>
            <advertise>false</advertise>
            <hierarchy>true</hierarchy>
            <indexable>true</indexable>
            <quota>false</quota>
            <searchable>true</searchable>
            <system>false</system>
            <unlogged>false</unlogged>
        </visibility>
        <definition>a!localVariables(
  local!recordId: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  local!assignee: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  local!taskDetails: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  local!taskedOn: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  local!taskFrom: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  local!deadline: a!refreshVariable(value: null, refreshOnVarChange: ri!sendTaskSuccess),
  {
    /* If the user just attempted to send a new task, inform them whether they were successful or not */
    if(
      not(isnull(ri!sendTaskSuccess)),
      if(
        ri!sendTaskSuccess,
        #&quot;SYSTEM_SYSRULES_richTextDisplayField&quot;(
          value: #&quot;SYSTEM_SYSRULES_richTextItem_v1&quot;(
            text: &quot;${taskReport_taskSentSuccess}&quot;
          ),
          align: &quot;CENTER&quot;
        ),
        #&quot;SYSTEM_SYSRULES_richTextDisplayField&quot;(
          value: &quot;${taskReport_taskSentFailure}&quot;,
          align: &quot;CENTER&quot;
        )
      ),
      {}
    ),
    #&quot;SYSTEM_SYSRULES_sectionLayout_v1&quot;(
      label: if(
        or(isnull(local!recordId), length(local!recordId) = 0),
        &quot;${taskReport_sendTaskLabel}&quot;,
        ${taskReport_sendTask_header_oneRecord}
      ),
      showWhen: ri!sendingTask,
      contents: {
        #&quot;SYSTEM_SYSRULES_pickerFieldRecords&quot;(
          label: &quot;${recordType_singularName_escaped}&quot;,
          instructions: &quot;${taskReport_sendTask_instructions}&quot;,
          maxSelections: 1,
          recordType: #"urn:appian:record-type:v1:${recordType_uuid}",
          value: local!recordId,
          saveInto: local!recordId,
          required: true
        ),
        #&quot;${interface_sendTaskDetails_uuid}&quot;(
          assignee: local!assignee,
          taskDetails: local!taskDetails,
          deadline: local!deadline
        ),
        #&quot;SYSTEM_SYSRULES_ButtonLayout&quot;(
          primaryButtons: {
            #&quot;SYSTEM_SYSRULES_ButtonWidget&quot;(
              label: &quot;${sendTask_submit}&quot;,
              style: &quot;PRIMARY&quot;,
              confirmMessage: if(
                or(
                  isnull(local!assignee),
                  a!isUserMemberOfGroup(local!assignee, #&quot;${constant_group_uuid}&quot;)
                ),
                &quot;&quot;,
                &quot;${taskReport_sendTask_confirmation}&quot;
              ),
              value: false,
              saveInto: {
                /* On submitting, start the Send Task process and pass parameters into it. *
                 * If successful, clear the form values for next time. Otherwise, do not,  *
                 * as the user may wish to try again.                                      */
                a!save(local!taskedOn, now()),
                a!save(local!taskFrom, loggedinuser()),
                #&quot;SYSTEM_SYSRULES_startProcess&quot;(
                  processModel: #&quot;${constant_sendTaskModel_uuid}&quot;,
                  processParameters: {
                    assignee: local!assignee,
                    taskDetails: local!taskDetails,
                    deadline: local!deadline,
                    taskedOn: local!taskedOn,
                    taskFrom: local!taskFrom,
                    recordId: local!recordId
                  },
                  onSuccess: {
                    a!save(ri!sendTaskSuccess, true),
                    a!save(ri!sendingTask, false)
                  },
                  onError: {
                    a!save(ri!sendTaskSuccess, false)
                  }
                )
              },
              validate: true
            )
          },
          secondaryButtons: {
            #&quot;SYSTEM_SYSRULES_ButtonWidget&quot;(
              label: &quot;${cancel}&quot;,
              style: &quot;NORMAL&quot;,
              value: false,
              saveInto: ri!sendingTask,
              validate: false
            )
          }
        )
      }
    )
  }
)</definition>
        <namedTypedValue>
            <name>sendingTask</name>
            <type>
                <name>boolean</name>
                <namespace>http://www.w3.org/2001/XMLSchema</namespace>
            </type>
        </namedTypedValue>
        <namedTypedValue>
            <name>sendTaskSuccess</name>
            <type>
                <name>boolean</name>
                <namespace>http://www.w3.org/2001/XMLSchema</namespace>
            </type>
        </namedTypedValue>
        <metadataExpr></metadataExpr>
        <preferredEditor>interface</preferredEditor>
        <offlineEnabled>false</offlineEnabled>
    </rule>
    <roleMap public="true">
        <role allowForAll="false" inherit="true" name="readers">
            <users/>
            <groups/>
        </role>
        <role allowForAll="false" inherit="true" name="authors">
            <users/>
            <groups/>
        </role>
        <role allowForAll="false" inherit="true" name="administrators">
            <users/>
            <groups/>
        </role>
        <role allowForAll="false" inherit="false" name="denyReaders">
            <users/>
            <groups/>
        </role>
        <role allowForAll="false" inherit="false" name="denyAuthors">
            <users/>
            <groups/>
        </role>
        <role allowForAll="false" inherit="false" name="denyAdministrators">
            <users/>
            <groups/>
        </role>
    </roleMap>
</contentHaul>
