How to script If a value has changed?

Su522
Kilo Sage

I need an onSubmit Client Script but I also need it to check if the 'State' field value has changed.

How can this be scripted?

 

Thank you,
Susan

8 REPLIES 8

Hi @Su522 ,

 

Update script like below:

 

function onSubmit() {

	var subjectPersonValue = g_form.getValue('subject_person');
	var openedForValue = g_form.getValue('opened_for');
	var openedFor = g_form.getControl('opened_for');
	
	if(openedFor.changed){
		if (subjectPersonValue == openedForValue) {
			confirm("You have set the Opened For to the Subject Person, which will grant them access to view the Case - are you sure?");
		}
	}
}

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

@Su522 - sorry I didn't get your question. You got the script working with the above but what are you asking here?

@James Chun 

Yes I got the script working with the code I posted.

I was asking if its possible to use a BR for a pop window for processing - Ok (proceed) or Cancel (abort the operation) 

@Su522 - Since you are using a GlideModal, it wouldn't be a good user experience to use a BR. If you are using a BR, the validation will occur after the pop-up is closed and as the form is saving, it will throw an error.

 

But I would still recommend having a BR as the record can be updated in a different UI (e.g. list view).