Workspace UI Action not saving

Misgana
Tera Guru

I have created a new UI Action for the workspace that changes the state of the case to closed and populate the resolved by and the resolved date but it doesn't save the record after clicking the button.

Here is the code I have written:

function onClick(g_form) {
   
    if (g_form.getValue('close_notes') == "") {
        g_form.hideFieldMsg('close_notes');
        g_form.showFieldMsg('close_notes', 'Please give a resolution note.', 'error');
        g_form.addErrorMessage("resoloution notes field is empty");

    }
    if (g_form.getValue('resolution_code') == "") {
        g_form.hideFieldMsg('resolution_code');
        g_form.showFieldMsg('resolution_code', 'Please choose a resolution code.', 'error');
        g_form.addErrorMessage("resoloution code field is empty");

    }

    if ((g_form.getValue('resolution_code') && g_form.getValue('close_notes')) != "") {
        g_form.setValue('state', '3');
        g_form.setValue('resolved_by', g_user.userID);
        g_form.setValue('resolved_at', formatDate(new Date(), g_user_date_time_format));
        g_form.save();

    }

}

3 REPLIES 3

Aman Kumar S
Kilo Patron

Hope you have checked Client checkbox in the UI action form. Also check if all the mandatory fields are filled before form gets submitted.

 

Best Regards
Aman Kumar

Hey,

Didn't hear back on this.

Is your issue resolved? If yes, feel free to mark helpful/correct, so it will be helpful for others looking for similar query.

Best Regards
Aman Kumar

dewanshu madan
Tera Contributor

Hi Misgana

Did you get any solution for this. 

I am also facing the same issue. The worknotes are getting updated but the state is not changing.