{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":10691,"path":"employee-service-management/employee-readiness-core/create-readiness-requirement.md","title":"Create a health and safety requirement","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a health and safety requirement\n\nCreate requirements to track when employees are ready to return to the workplaceor visit a site. You can also create requirements that visitors must complete before entering the workplace.\n\n## Before you begin\n\nRole required: sn\\_imt\\_core.admin\n\n## About this task\n\nUse health and safety requirements to define the requirements that employees must fulfill before they can return to the workplace, or that visitors must fulfill before entering the workplace. Create separate requirements for employees and visitors. A requirement must apply to either employees or visitors, not both. Employee Readiness Core provides some [pre-built requirements](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/employee-service-management/employee-readiness-core/included-health-safety-requirements.md). However, you can create additional requirements using data from any of the Safe Workplace suite or Emergency Response Management apps.\n\nHealth and safety requirements are built with [Flow Designer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/flow-designer.md). Before creating a requirement, make sure that you're familiar with the basics of ServiceNow® Workflow Studio.\n\nThe following steps show how to create a requirement using the pre-built Employee Health Verification Requirement as an example.\n\n## Procedure\n\n1.  In Workflow Studio, create an action to check the requirement status for an employeeor visitor.\n\n    1.  Create an action.\n\n    2.  Save the action in the Employee Readiness Core application.\n\n    3.  In the Inputs section of the Action Outline, create an input for the type of record that you will use to check if the employeeor visitor has fulfilled the requirement.\n\n        For example, to fulfill the Employee Health Verification Requirement, employees must have a health verification record in the Employee Health Verification table \\[sn\\_imt\\_monitoring\\_health\\_verification\\].\n\n        |Label|Name|Type|Mandatory|\n        |-----|----|----|---------|\n        |Employee Health Verification|health\\_verification|Reference.Employee Health Verification \\[sn\\_imt\\_monitoring\\_health\\_verification\\]|Yes|\n\n    4.  Add a **Script Step** to the Action Outline.\n\n    5.  In the **Required Runtime** field, select **Instance**.\n\n    6.  Create an input variable using the input that you created for the action as the value.\n\n        This enables you to use the input for the action in a script.\n\n        |Name|Value|\n        |----|-----|\n        |health\\_verification|**Employee Health Verification** input that you created in the Inputs section.|\n\n    7.  In the **Script** field, add a script to define the conditions when an employee'sor visitor's requirement status is `cleared` or `not_cleared`.\n\n        For the Employee Health Verification Requirement, the requirement is `cleared` for an employee if their health verification response is `yes`, and `not_cleared` for any other response.\n\n        ```\n        (function execute(inputs, outputs) {\n        \toutputs.requirement_status = inputs.health_verification.response == 'yes'\n            \t? 'cleared'\n            \t: 'not_cleared';\n        })(inputs, outputs);\n        ```\n\n    8.  Create an output variable for the requirement status.\n\n        This defines the *requirement\\_status* variable that you used in the script.\n\n        |Label|Name|Type|Mandatory|Choice \\(Advanced options\\)|\n        |-----|----|----|---------|---------------------------|\n        |requirement\\_status|requirement\\_status|Choice|Yes|Dropdown with --None--|\n\n    9.  In the Outputs section of the Action Outline, create an output for the requirement status.\n\n        Creating this output enables you to use the *requirement\\_status* output variable from the script as an output returned by the action.\n\n        |Label|Name|Type|Mandatory|Choice \\(Advanced options\\)|\n        |-----|----|----|---------|---------------------------|\n        |Requirement status|requirement\\_status|Choice|No|Dropdown with --None--|\n\n    10. Assign the *requirement\\_status* value to the output.\n\n        |Label|Value|\n        |-----|-----|\n        |Requirement Status|*requirement\\_status* output variable from the script step.|\n\n        The action returns the value of the *requirement\\_status* for the employeeor visitor \\(`cleared` or `not_cleared`\\) as an output.\n\n    11. Click **Publish**.\n\n2.  Create a health and safety requirement.\n\n    1.  Navigate to **Employee Health and Safety Status** &gt; **Health and Safety Requirements**.\n\n    2.  Click **New**.\n\n    3.  On the form, fill in the fields.\n\n        The Include previous applicable records section defines a set of records that have already been created but should still trigger the requirement flow. Including previous records ensures that employees or visitorswho complete the requirement before it is activated have their requirement status set to **Cleared**.\n\n<table id=\"table_wxk_x2n_2mb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nUnique name for the requirement. For example, `Employee Health Verification Requirement`.\n\n</td></tr><tr><td>\n\nRequirement for\n\n</td><td>\n\nWho the requirement applies to. The options are **Employee** and **Visitor**. A requirement must apply to either employees or visitors, not both.For example, the Employee Health Verification requirement only applies to employees.\n\n</td></tr><tr><td>\n\nRequirement flow\n\n</td><td>\n\nLeave this field empty. You will return to the requirement record and fill in this field after you create the flow.\n\n</td></tr><tr><td>\n\nActive\n\n</td><td>\n\nThis field is read-only. Once you update all fields for the requirement, you can use the **Activate** button to activate the requirement.\n\n</td></tr><tr><td>\n\nDefault status\n\n</td><td>\n\nThe default status is assigned to health and safety users who don't have any activity towards completing the requirement. The options are **Cleared** and **Not Cleared**.For example, employees who don't have a health verification record are assigned a default status of **Not Cleared** for the Employee Health Verification Requirement.\n\n</td></tr><tr><td>\n\nUse duration\n\n</td><td>\n\nOption to set a time limit that the requirement status is valid for.\n\n</td></tr><tr><td>\n\nValid for\n\n</td><td>\n\nTime limit that the requirement status is valid for. For example, the Employee Health Verification Requirement status is valid for seven days. Employees must resubmit their health verification weekly to continue fulfilling the requirement.\n\n This field appears only when the **Use duration** field is selected.\n\n</td></tr><tr><td>\n\nActionable\n\n</td><td>\n\nOption to add a link for employees to complete the requirement on the Health and Safety Status page.\n\n</td></tr><tr><td>\n\nAction name\n\n</td><td>\n\nThe name of the action for the employee to complete the requirement. For example, **Submit self-report**. This name is shown on the Health and Safety Status page.This field appears only when the **Actionable** field is selected.\n\n</td></tr><tr><td>\n\nAction URL\n\n</td><td>\n\nThe URL of the Service Catalog item that employees use to complete the requirement. For example, the Employee Health Verification Requirement is completed by submitting the Health Verification form, which has the URL `?id=sc_cat_item&sys_id=9c578864ed111010fa9b395e35885545`.\n\n This field appears only when the **Actionable** field is selected.\n\n</td></tr><tr><td>\n\nAction visibility\n\n</td><td>\n\nSets when the link to complete the requirement is displayed on the Health and Safety Status page. Select **Visible when false** to only show the link when the employee hasn't completed the requirement, or select **Always visible** to always show the link.This field appears only when the **Actionable** field is selected.\n\n</td></tr><tr><td>\n\nExclude\n\n</td><td>\n\nWhen selected, excludes all users in the **Audience** field from the requirement.\n\n</td></tr><tr><td>\n\nAudience\n\n</td><td>\n\nSelect the audience to refine the number of users the requirement applies to. For example, you might want to target all users in an audience that happens to be located in California or target an audience you created specifically for a location, regardless of whether they are users who are traveling, visiting, or working in the location.\n\n No audience is selected by default and the requirement applies to users based on the rest of the form.\n\n **Note:** If **Exclude** is checked, the requirement targets all users except those in the audience.\n\n</td></tr><tr><td colspan=\"2\">\n\nInclude previous applicable records\n\n</td></tr><tr><td>\n\nTable\n\n</td><td>\n\nTable to look for previously created records that will trigger the requirement flow.For example, the Employee Health Verification Requirement uses the Employee Health Verification table \\[sn\\_imt\\_monitoring\\_health\\_verification\\].\n\n</td></tr><tr><td>\n\nCondition\n\n</td><td>\n\nAdd conditions to filter the records from the table that will trigger the flow.\n\n</td></tr></tbody>\n</table>    4.  Click **Submit**.\n\n3.  In Workflow Studio, create a flow to update the requirement status for an employeeor visitor.\n\n    1.  Create a new flow.\n\n    2.  Save the flow in the Employee Readiness Core application.\n\n    3.  Add a trigger so that the flow runs whenever the type of record that you're using to check the requirement status is created or updated.\n\n        For example, for the Employee Health Verification Requirement, the flow runs whenever a health verification record is created or updated.\n\n        |Trigger|Table|Condition|Run Trigger|\n        |-------|-----|---------|-----------|\n        |Created or Updated|Employee Health Verification \\[sn\\_imt\\_monitoring\\_health\\_verification\\]|None.|For each unique change|\n\n    4.  Add the action that you created to the flow.\n\n    5.  Add the record from the trigger as the input.\n\n        For example, for the Employee Health Verification input, add the Employee Health Verification record that was created or updated in the trigger event.\n\n    6.  Add the Update User Requirement action provided in Employee Readiness Core to the flow.\n\n        |User \\[User\\]|Health and safety requirement \\[Health and Safety Requirement\\]|Requirement status|Trigger datetime|\n        |-------------|---------------------------------------------------------------|------------------|----------------|\n        |**Employee** or **User** field from the trigger record. For example, the **Employee** field from the Employee Health Verification record.|Health and safety requirement you created.|`requirement_status` returned by the action that you created.|**Created** field from the trigger record. Only use this input if you set a value for the **Valid for** field on the requirement.|\n\n    7.  Click **Activate**.\n\n4.  Complete the health and safety requirement.\n\n    1.  Navigate to **Employee Health and Safety Status** &gt; **Health and Safety Requirements**.\n\n    2.  Click the requirement that you created earlier.\n\n    3.  In the **Requirement flow** field, add the flow that you created to update the requirement status for employeesor visitors.\n\n    4.  Click **Update**.\n\n\n## What to do next\n\nWhen you create the requirement, it's not active by default. You must activate the requirement before you can track whether employeesor visitors have fulfilled the requirement. For instructions, see [Activate a health and safety requirement](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/employee-service-management/employee-readiness-core/activate-readiness-requirement.md).\n\n**Parent Topic:**[Employee Health and Safety Status](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/employee-service-management/employee-readiness-core/employee-health-safety-status.md)\n\n"}}