Configuring an advanced custom prompt

This topic outlines some of the more advanced features of custom prompts and contains an example of how to configure multiple prompts during a Clock IN by using the options type configuration. Multiple prompts are chained together and additional prompts are displayed that are conditional upon the employee's response to the previous prompt. This is only an example and you can modify the attributes in this and other examples in this guide to suit your business requirements. The available attributes are listed in Available atributes for custom prompts.

The clock.xml file in your deployment contains the example below of a more advanced custom prompt. This topic will use this example to provide more information on the capabilities of this particular configuration and the custom prompt framework in general.


** FIRST PROMPT **
	
<prompt id="SICK_PROMPT" code="SICK" type="options"  >
	<trigger punch="in" code="" value="" />
	<option id="YES" order="1" acceptSwipe="true" data="Y" />
	<option id="NO" order="1" acceptSwipe="true" data="N" />
	<cancel allowed="true" acceptSwipe="false" data="I" message="SICK_PROMPT_RESPONSE_REQUIRED" 
      swipeRejectedReason="SICK_PROMPT_CANCELLED"  />
	<timeout seconds="15" acceptSwipe="false" data="T" swipeRejectedReason="SICK_PROMPT_TIMEDOUT"  />
	</prompt>
	
** SECOND PROMPT ** 

<prompt id="MASK_PROMPT" code="MASK" type="options"  >
	<trigger punch="in" code="SICK" value="Y" />
	<option id="YES" order="1" acceptSwipe="true" data="Y" />
	<option id="NO" order="2" acceptSwipe="true" data="N" message="GET_MASK" 
      messageDisplaySeconds="15" />
	<timeout seconds="10" acceptSwipe="true" data="T" />
</prompt>

** THIRD PROMPT ** 

<prompt id="WASH_PROMPT" code="WASH" type="options"  >
	<trigger punch="in" code="SICK" value="N" />
	<option id="YES" order="1" acceptSwipe="true" data="Y" />
	<option id="NO" order="2" acceptSwipe="true" data="N" message="WASH_HANDS" 
      messageDisplaySeconds="5"  />
	<timeout seconds="10" acceptSwipe="true" data="T" />
</prompt>

Overview of the first prompt

The first prompt of prompt id="SICK_PROMPT" in the example above does the following:

  • It displays a message of SICK_PROMPT ("Are you sick?"). This message can be localized in the clock.properties file of your deployment.
  • It is triggered for every Clock In transaction due to this syntax in the above example code:
    trigger punch="in"
  • It is an options type prompt that displays options to the users in the form of questions:
    type="options"
  • In menu position 1 on the clock (corresponds to the F1 key), the prompt displays Yes. The Clock In is accepted if the employee says Yes:
    option id="YES" order="1" acceptSwipe="true" data="Y"
  • If the user selects Yes for this prompt, SICK=Y will be recorded in the EXTRADATA of the clock transaction due to this code:
    code="SICK" data="Y"
  • In menu position 2 on the clock (corresponds to the F2 key), it displays No. The Clock In is accepted if the employee says No:
    option id="NO" order="1" acceptSwipe="true" data="N"
  • If the employee cancels the transaction, the Clock In is rejected and SICK=I is recorded in EXTRADATA of the clock transaction:
    cancel allowed="true" acceptSwipe="false" data="I"
  • If the employee cancels the transaction a message of SICK_PROMPT_RESPONSE_REQUIRED ("Transaction Cancelled. Punch will not be recorded") is displayed to the user and a message of SICK_PROMPT_CANCELLED ("Declined to respond to questionnaire.") is recorded in the clock journal for the transaction. These messages can be localized in the clock.properties file of your deployment.
  • If the transaction times out, the Clock In is rejected and a message of SICK_PROMPT_TIMEDOUT ("Timed out during questionnaire.") is recorded in the clock journal for the transaction.
  • Time out transactions will record SICK=T in EXTRADATA of the clock transaction.

Overview of the second prompt

The second prompt of prompt id="MASK_PROMPT" in this example does the following:

  • It displays a message of MASK_PROMPT ("Are you wearing an N95 mask?"). This message can be localized in the clock.properties file of your deployment.
  • It is triggered if the employee on the first prompt answers Yes:
    trigger punch="in" code="SICK" value="Y"
  • The logic for menu items, EXTRADATA recorded, the messages displayed and the swipe acceptance criteria are similar to the examples given in the first prompt.

Overview of the third prompt

The third prompt of prompt id="WASH_PROMPT" in this example does the following:

  • It displays a message of WASH_PROMPT ("Have you washed your hands?"). This message can be localized in the clock.properties file of your deployment.
  • It is triggered if the employee on the first prompt answers No:
    trigger punch="in" code="SICK" value="N"
  • The logic for menu items, EXTRADATA recorded, the messages displayed and the swipe acceptance criteria are similar to the examples given in the first prompt.

Other important information

  • The order of the prompts is important when linking multiple prompts as in the example above. The logic for the prompts must progress in a linear fashion within the clock.xml file.
  • The XML for the prompt must be valid for the prompt configuration to work.
  • The conf/clock.xsd file is useful for advanced users as it outlines the possible attributes and elements that you can have in the clock.xml file. It is strongly recommended that this file is not modified as it may lead to unexpected issues.
  • For the third prompt in this example, you can use value="" to prompt the user to wash their hands regardless of their answer to the previous prompt:
    trigger punch="in" code="SICK" value=""