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

shloke04
Kilo Patron

Hi,

I think you have asked the same question in another thread. I would request you to please keep just one thread for same query. 

https://community.servicenow.com/community?id=community_question&sys_id=2dac67d01b3c8554ada243f6fe4bcba7

I have already provided a solution in the other thread of yours, pasting it here again:

 

1) Write an On Submit Client Script on your catalog Task table and use the script as below:

function onSubmit() {
   //Type appropriate comment here, and begin script below
   var getButtonClicked = g_form.getActionName();
	
	if(getButtonClicked == 'sysverb_update' || getButtonClicked == 'sysverb_insert_and_stay' || getButtonClicked == 'sysverb_update_and_stay' || getButtonClicked == 'sysverb_insert' || getButtonClicked == 'sysverb_update'){
		g_form.setMandatory('FIELDNAME',false);
		g_form.setDisplay('FIELDNAME',false);
	}
}

In above script pass the correct Field name above and you should be good.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 
Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke