Reject UI Action on Demand

User177031
Kilo Guru

Hi All,

Can anyone help me with the below requirement.

Create 'Reject' UI Action on demand & it should appear when demand is in deferred state.
Rejecting the demand should set the demand to inactive and state = reject. Also make a worknote required

- Thank you.

1 ACCEPTED SOLUTION

I just realized that client and server code is mixed up. Try this code.

Make sure you check the client checkbox, specify the Onclick function and add an action name for your UI action as reject_demand

Also use the actual state choice value for the Reject state and not its label.

find_real_file.png

function reject(){
	if(g_form.getValue('work_notes') == ''){
		g_form.setMandatory('work_notes', true);
		g_form.addInfoMessage("Enter Work notes");
		return;
	}
	//Call the UI Action and skip the 'onclick' function
	gsftSubmit(null, g_form.getFormElement(), 'reject_demand'); //MUST call the 'Action name' set in this UI Action
}

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

//Server-side function
function rejectDemand(){
	current.state = '2';  //Replace with your reject state choice value
	current.active = false;
	current.update();
	action.setRedirectURL(current);
}

View solution in original post

7 REPLIES 7

I just realized that client and server code is mixed up. Try this code.

Make sure you check the client checkbox, specify the Onclick function and add an action name for your UI action as reject_demand

Also use the actual state choice value for the Reject state and not its label.

find_real_file.png

function reject(){
	if(g_form.getValue('work_notes') == ''){
		g_form.setMandatory('work_notes', true);
		g_form.addInfoMessage("Enter Work notes");
		return;
	}
	//Call the UI Action and skip the 'onclick' function
	gsftSubmit(null, g_form.getFormElement(), 'reject_demand'); //MUST call the 'Action name' set in this UI Action
}

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

//Server-side function
function rejectDemand(){
	current.state = '2';  //Replace with your reject state choice value
	current.active = false;
	current.update();
	action.setRedirectURL(current);
}

Nikhil Pandit
Mega Guru

hi Sai

U can write ui action on demand table and add condition accordingly.

in script part write

current.setValue('state','rejected'); or choice code for rejected choice.

current.setValue('Active',false);

current.update();

Hi Nikhil,

How do we make the ''worknotes'' mandatory?

- Thank you