Take wo ownership
About this task
A common scenario for customers is for the technician to take ownership of the WO in the details page. For this example to work, ensure the owner attribute is part of the woDetailResource and display this on the details page.
Procedure
Step 1: In App.xml add a button to the “workOrderDetails” page.
<button icon="carbon:user--avatar" on-click="ownershipClick" label="Take Ownership" on-click-arg="{{'item':woDetailResource.item,'datasource':woDetailResource}}" hidden="{woDetailResource.item.owner==app.client.userInfo.personid}"/>
Step 2: Crete the method in AppCustomizations.js file.
async ownershipClick(event){let item=event.item;let datasource=event.datasource;item.owner=this.app.client.userInfo.personid;await datasource.save();}