what is the name and where I can find these backend name?

ak49
Tera Contributor

Hi I am writing client script when I will click on save or update button then particular field on form should be hide and when I will click on the close task button then that particular field should be visible and mandatory and after selecting that field value and click on close task button then it will be close successfully. Please help me on this and I am attaching screenshots and give you that scripts.

 

function onSubmit() {

var actionClicked = g_form.getActionName();

if(actionClicked == "sysverb_update_and_stay" || actionClicked == "sysverb_update"){
g_form.setDisplay("u_purchase_or_deploy", false);
return true;
}else if(actionClicked == "closetask"){
g_form.setMandatory("u_purchase_or_deploy", true);
return false;
}
}

 

find_real_file.png

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

Try using the value in the Action name field on the UI Action records.  close_sc_task and sysverb_delete

If I want to set a mandatory field using client script then how to do that?

I would take the approach of copying the UI Action (if it's using the Global 'table') check the Client box if it's not already, then make the script work as a client script, adding in your show/hide and mandatory requirements.  There's an out of box Close Task UI Action on the sc_task table that is already running on the Client as it is changing the State to 3, so that's a good place to start.

ChrisBurks
Mega Sage

If a UI Action doesn't have an action name set on its record then the sys_id of the UI Action record becomes the action name.

You can check this by doing an inspect element on the button. The id and the data-action-name element attributes will contain the sys_id of the UI Action record. Whereas if you do an inspect element on a UI Action with the action name set, the attributes will contain that action name.

Albeit, usually the Close Task's action name is close_sc_task depending on the condition set on the UI actions set on that table.