Hidden fields appearing on RITM form in Service Portal

Kai Tingey
Tera Guru

Hi All

I have an issue with one of my catalog items, where the RITM page on the portal is showing a hidden field after you submit the request.

For example, here is the form

find_real_file.png

a client script is hiding some fields (i am using a client script because the field values are being generated dynamically by another client script... it's a painful form)

however when you hit submit, one of the hidden fields is shown on the RITM page

find_real_file.png

There is a a UI policy that hides all these fields on form load, then the client script takes care of turning them on or off depending on what the user selects. Both the script and UI policy are set to apply to cat items, req items and cat tasks.

find_real_file.png

this is the script

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	
if (g_form.getValue('gis_request_category') == 'gis_map_production'){
	g_form.setDisplay('gis_map_production_form',true);	
	g_form.setDisplay('gis_interactive_map_form',false);	
	g_form.setDisplay('gis_service_type',false);
	g_form.setDisplay('gis_data_request_type',false);
	g_form.setDisplay('gis_user_request_type',false);
}
else if (g_form.getValue('gis_request_category') == 'gis_interactive_map_request'){
	g_form.setDisplay('gis_interactive_map_form',true);	
	g_form.setDisplay('gis_map_production_form',false);	
	g_form.setDisplay('gis_service_type',false);
	g_form.setDisplay('gis_data_request_type',false);
	g_form.setDisplay('gis_user_request_type',false);
}
	
else if (g_form.getValue('gis_request_category') == 'gis_imagery_services'){
		g_form.setDisplay('gis_service_type',true);
		g_form.setDisplay('gis_interactive_map_form',false);	
		g_form.setDisplay('gis_map_production_form',false);	
		g_form.setDisplay('gis_data_request_type',false);
		g_form.setDisplay('gis_user_request_type',false);
}
	
else if (g_form.getValue('gis_request_category') == 'gis_data_management'){
		g_form.setDisplay('gis_interactive_map_form',false);	
		g_form.setDisplay('gis_map_production_form',false);	
		g_form.setDisplay('gis_service_type',false);
		g_form.setDisplay('gis_data_request_type',true);
		g_form.setDisplay('gis_user_request_type',false);
		g_form.clearValue('gis_user_request_type');
}
else if (g_form.getValue('gis_request_category') == 'gis_user_management'){
		g_form.setDisplay('gis_interactive_map_form',false);	
		g_form.setDisplay('gis_map_production_form',false);	
		g_form.setDisplay('gis_service_type',false);
		g_form.setDisplay('gis_data_request_type',false);
		g_form.setDisplay('gis_user_request_type',true);	
		g_form.clearValue('gis_data_request_type');
}
	
else if (g_form.getValue('gis_request_category') != 'gis_interactive_map_request' | g_form.getValue('gis_request_category') != 'gis_map_production'){
		g_form.setDisplay('gis_interactive_map_form',false);	
		g_form.setDisplay('gis_map_production_form',false);	
		g_form.setDisplay('gis_service_type',false);
		g_form.setDisplay('gis_data_request_type',false);
		g_form.setDisplay('gis_user_request_type',false);
}


   
}

Also if anyone knows how to get the RITM form to display the label for request category, rather than the value, that would be handy. The request category is one where the list values are generated dynamically (hence the need for a script)

1 ACCEPTED SOLUTION

Hang on, i think i know

 

the script is clearing the values in the other two fields. Whereas service type has a value in it whether it's hidden or not, so i bet that's the problem.

View solution in original post

13 REPLIES 13

is there anything in the variable after the form has been submitted? or is it empty?

I'm removing all option with g_form.clearOptions() when category is changed:

 

acjunior_0-1722516681493.png

But when I submit the form, the value is displayed for Subcategory

acjunior_1-1722516808567.png

 

there's got to be something that's populating it.

Is there a default value?

have you tried g_form.clearValue(subcategory)? did you get the same thing?

any business rules or other client scripts running on that table that might be inserting a value when it's submitted or updated?
is it always the same value regardless of whats in the category field, or does it change dependant on whats in Category?

aah got it now. 

is that same client script which you added , that's hiding the variable ?

 

why don't you use UI Policy here, no script required.