Client Script isn't working for Agent Workspace
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 09:13 AM
Hey All,
I'm trying to get my client script to work for agent workspace.
I have my UI Type as Mobile/Service Portal. I'm trying to set the Date/Time field of window end.
Below is my code. Any suggestions?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var date = g_form.getValue("window_start");
g_form.addInfoMessage("This is the value of the window start date: " + date);
var format = g_date_time_format.replace("dd", "DD").replace("yyyy", "YYYY"); // moment.js expects upper case for date
var shortDescription = g_form.getValue('short_description');
var location = g_form.getValue('wu_location_queue');
if (shortDescription == 'Accessory pickup') {
var startDateMs = new moment(date, format).valueOf(); // get date strings into a number of milliseconds since 1970-01-01
g_form.addInfoMessage("This is the value for startDateMs variable: " + startDateMs);
var endDateAccessoryPickUp = new Date(date.getTime() + 900000); //15 minutes for Accessory Pickup in milliseconds
g_form.addInfoMessage("This is the value for window end time: " + endDateAccessoryPickUp);
}
//Type appropriate comment here, and begin script below
}
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 11:14 AM
Hi @Community Alums Have you tried with Client Script UI Type as All. Try to make it UI Type as All and see if it works in Native UI.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 10:47 AM
We discovered that it won't work via the agent workspace.