If you are using the Health and Safety module, you can also allow your dispatchers and workers to identify and record hazards on a job. Workers will not be able to complete the job until they acknowledge the hazards identified.
While it is possible to add default hazards to the web interface, these are only for dispatcher or worker use. If you wish to add hazards to a job via the API, you do not reference the existing hazards in the account, you include them in the XML for the job.
To post an unpopulated hazard called "Risk of Explosion" to a job, you would include the following XML in either the job PUT or POST. In this example, vWork would automatically create the other required fields for the hazard and force the mobile worker to fill them in before completing the job.
<enable_hazards>true</enable_hazards>
<hazards type="array">
<hazard>
<description>Risk of Explosion</description>
</hazard>
</hazards>If you wanted to create the entire hazard and specify more details for the worker, you would include the following XML in either the job PUT or POST. In this case, vWork would only prompt the worker to acknowledge the hazard as the values have already been pre-defined. (The worker still has the option of editing these values if they need to.)
<enable_hazards>true</enable_hazards>
<hazards type="array">
<hazard>
<description>Risk of Explosion</description>
<fields type="array">
<field>
<type>risk_picklist</type>
<label>Initial Risk</label>
<value>High</value>
</field>
<field>
<type>risk_picklist</type>
<label>Residual Risk</label>
<value>Low</value>
</field>
<field>
<type>control_picklist</type>
<label>Control Type</label>
<value>Eliminate the Hazard</value>
</field>
<field>
<type>text</type>
<label>Controls Required</label>
<value>Shut down all power feeds to circuits being worked on.</value>
</field>
<field>
<type>text</type>
<label>Person Responsible</label>
<value>Fred Smith</value>
</field>
</fields>
</hazard>
</hazards>When adding hazards to a job, you also need to specify which step triggers the worker prompt to acknowledge the job hazards. This can be done by including the hazards_confirmation flag on any one of the job's steps:
<step>
<name>Arrive on Site</name>
<hazards_confirmation>true</hazards_confirmation>
</step>