The CreatorCon Call for Content is officially open! Get started here.

Client Script isn't working for Agent Workspace

Community Alums
Not applicable

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

Sid_Takali
Kilo Patron

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.

Community Alums
Not applicable

We discovered that it won't work via the agent workspace.