- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 06:09 AM
Hi
Can any one guide me how to create UI action (work order) for Service Request
We have OOTB UI action (Work Order) for Incident
Similar I want to create a custom UI action for Request.
Please guide me with steps and logics.
like this I want to enable for Request table
I created using same logic but its not working
By changing table name
Under script I changed to Request
Its not working and not loading the page
Is there anything missing I need to change any script or logic
Please guide me
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 09:34 AM - edited 11-05-2023 09:35 AM
Hi @Research ,
You need to create a new function on your script include.
For that, open the 'WorkManagementInitiation' script include ,
After the 'createWorkOrderFromIncident' function, create a new function as below:
createWorkOrderFromRequest: function(request) {
var workOrder = this._retrieveWorkOrder(true, request, true);
// work order already exists and redirection is already handled
if (workOrder == null)
return;
// complete the work order definition and creation
workOrder.location = request.location;// here you can add the fields that you'd like to map from the Request to the Work order
workOrder.caller = request.requested_for;
workOrder.description = request.description;
workOrder.insert();
// redirect to new work order
this._redirectToNewWorkOrder(workOrder, request);
return workOrder;
},
After adding the 'createWorkOrderFromRequest' function into the script include, navigate to the UI action table and create a new UI action in the Request table, calling the function.
If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 09:34 AM - edited 11-05-2023 09:35 AM
Hi @Research ,
You need to create a new function on your script include.
For that, open the 'WorkManagementInitiation' script include ,
After the 'createWorkOrderFromIncident' function, create a new function as below:
createWorkOrderFromRequest: function(request) {
var workOrder = this._retrieveWorkOrder(true, request, true);
// work order already exists and redirection is already handled
if (workOrder == null)
return;
// complete the work order definition and creation
workOrder.location = request.location;// here you can add the fields that you'd like to map from the Request to the Work order
workOrder.caller = request.requested_for;
workOrder.description = request.description;
workOrder.insert();
// redirect to new work order
this._redirectToNewWorkOrder(workOrder, request);
return workOrder;
},
After adding the 'createWorkOrderFromRequest' function into the script include, navigate to the UI action table and create a new UI action in the Request table, calling the function.
If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 06:41 AM - edited 11-06-2023 06:43 AM
Hi @Clara Lemos Appreciate for you solution this working as per expected.
For OOTB script include adding function its working
Can you guide the new script include for so I need to create custom script include instead of using OOTB script and adding function
Because my organization is asking to create new script Include.
we are near to solution can you please guide the new script include to add function only for request work order.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 08:10 AM
@Research ,
You can just create a new script include and copy the functions from the OOTB one, in the UI action you should call your new script include instead of the OOTB one