How to convert UI Action for use on Service Operations Workspace

Simba Naidu
Tera Contributor

Hi All,

 

I have the following UI action on the Change form to cancel the change request.

below script is used 

var changeConfirmCancelDialog;

function setChangeCancelState() {
    g_form.setValue("state", "4");
}

if (typeof window == 'undefined')
   setRedirect();

function setRedirect() {
    current.update();
    action.setRedirectURL(current);
}
 
I'm wanting to move this over to Service Operations Workspace but I am having issues. I clicked the checkbox to enable the workspace form button. Is there something that I'm missing here, do I need to put something on in the client script?
 
Thanks

 

 

1 ACCEPTED SOLUTION

It should be something like below:

Update Script and Workspace Client script part:

 

function setChangeCancelState() {
    g_form.setValue("state", "4");
	// Call the UI Action and skip the 'onclick' function
   gsftSubmit(null, g_form.getFormElement(), 'change_state'); // MUST call the 'Action name' set in this UI Action
}

 

Screenshot 2024-01-22 at 2.19.44 PM.png

View solution in original post

7 REPLIES 7

It should be something like below:

Update Script and Workspace Client script part:

 

function setChangeCancelState() {
    g_form.setValue("state", "4");
	// Call the UI Action and skip the 'onclick' function
   gsftSubmit(null, g_form.getFormElement(), 'change_state'); // MUST call the 'Action name' set in this UI Action
}

 

Screenshot 2024-01-22 at 2.19.44 PM.png

Simba Naidu
Tera Contributor

Hi @Anil Lande 

Sure. Please refer below screenshot.

SimbaNaidu_0-1705913378982.pngSimbaNaidu_1-1705913429349.png

SimbaNaidu_2-1705913469048.png

 

Change is not getting cancelled when I click on cancel button in workspace. Please do let me know if I am missing here.

 

Thanks

VaishnaviShinde
Kilo Sage

Hello @Simba Naidu ,

 

In workspace client script add below code

 

function onClick(g_form) {
    g_form.setValue('state', 4);
    g_form.save();
}

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde