Double Confirmation Should come when i select status field as reject?

Kruthik M Shiva
Tera Contributor

Hi All,
I have a requirement to pop up confirm if you have to reject the form and two choices should be there in pop up as yes or no if they select as change to reject status else previous status only be set. Please do share what needs to be done for this and if any scripting required please help on that as well.
Thanks in advance.

1 ACCEPTED SOLUTION

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Kruthik M Shiva ,

 

Kindly refer below code to achieve your requirement.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    if(newValue == 'rejected'){ // please use proper backend name of the reject status

	var answer = confirm('Do you wish to proceed with Rejecting the change');

	if(!answer){
		return false;// this will not allow the user to save the form with reject status
	}

	}

}

 

Please mark my answer helpful & accepted if it helps you resolve your issue.

 

Thanks,

Danish

View solution in original post

17 REPLIES 17

Can you attach screen shot, what you have done so far, and what errors you get.. It may helpful to answer the query.

 

Thank you

Please mark my answer helpful  & correct if it helps you
Thank you

G Ramana Murthy
ServiceNow Developer

Hi @RAMANA MURTHY G 
In the native view its working fine whereas in portal view I am getting JavaScript error for the same code. Ideally in my case the user will be changing the status in portal view only please do let me know the reason and solution if any for this.
Thank you

@Kruthik M Shiva ,

What error exactly you get, it will be more helpful if u provide any screenshots of what you are done so far, what error you get

 

Thank you

Please mark my answer helpful  & correct if it helps you
Thank you

G Ramana Murthy
ServiceNow Developer