If you are using the Health and Safety module, you can also allow your dispatchers to identify and record hazards on an asset. 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 an asset via the API, you do not reference the existing hazards in the account, you include them in the XML for the asset.
To post an unpopulated hazard called "Risk of Explosion" to an asset, 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>To remove a hazard from an asset, you would PUT the following XML to the asset.
<?xml version="1.0" encoding="utf-8"?>
<asset>
<hazards type="array">
<hazard>
<id>1733042</id>
<_destroy>true</_destroy>
</hazard>
</hazards>
</asset> To remove all hazards from an asset, you can PUT an empty hazard array, like so:
<?xml version="1.0" encoding="utf-8"?>
<asset>
<hazards type="array">
</hazards>
</asset>