Hidden fields not showing in HR Case form even if the setVisible is set to true

Arlene H
Tera Expert

Hi,

 

I have this record producer with a few variables set hidden=true.  In ITSM, I would normally set the property: global=true so that they become visible on the RITM or Task when setVisibility in the UI Policy or Catalog Client Scripts set them to true.  In the Employee Center (EC) Portal, the variables are working as expected.  That means, they are hidden on load as the hidden=true, then becomes visible when a certain selection is selected.  However, when the request is submitted, in the HR Case form, all these fields set to hidden=true are not visible even if they were visible on the EC portal.

 

I had to set them to hidden=true because all these fields become visible in the HR Case form even if the UI Policy or Client Scripts set them to hidden. It works in the EC portal, but the HR case form is always problematic.  Am I missing anything?

 

I've attached the variables attribute for your guidance.

 

Help please. Thank you.Record Producer fields.PNG

 

 

1 ACCEPTED SOLUTION

Have you created any client script or UI policy for visibility of required variables that are applied on the HR case table? Because as per my understanding you have added client script but that was only applies on the target records and catalog item view. 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

View solution in original post

6 REPLIES 6

Dnyaneshwaree
Mega Sage

Hello @Arlene H ,

Have you check that, is there any UI Policies/ Client Scripts applies on the HR Case table is conflicting on your logic or not?


Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hi @Dnyaneshwaree,

 

Thanks for the reply. I've thoroughly checked everything, but for something that seems very easy, I'm still baffled by this issue.

 

I disabled all the UI policies just to ensure nothing is conflicting and just have one Client Script that works perfectly on the EC Portal. This Client Script uses the onChange event. When an option is selected, it sets the fields (initially hidden by their properties, as shown in the attached screenshot) to visible. This works perfectly on the EC Portal.

 

The problem arises on the HR Case forms, where the fields remain invisible despite the Client Script setting them to visible onChange. Is this the expected behavior in HR Cases when a field's property is set to hidden=true, even if the Client Script changes it to visible onChange?

 

In ITSM, this wouldn't be an issue. I would simply set:

 

Applies on Catalog Tasks

Applies on a Catalog Item View

Applies on Requested Items 

and set the variable's property:  global=true 

 

For HR, I can only set it to:

Applies to Target Record

Applies to a Catalog Item View

 

Nothing happens, still invisible. I made my Client Script simpler for testing purposes (I am aware I can use UI policies for this, but it's easier to test the concept using script).

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	var request_type = g_form.getValue('request_type');
	switch(request_type){
		case "0":
			g_form.setMandatory('subject_person', false);
			g_form.setMandatory('subject_person_location', false);

			g_form.setVisible('subject_person', false);		
			g_form.setVisible('subject_person_location', false);	
			break;
		case "1":
			g_form.setMandatory('subject_person', true);
			g_form.setMandatory('subject_person_location', true);	
					
			g_form.setVisible('subject_person', true);
			g_form.setVisible('subject_person_location', true);	
			break;
	}
}

 

As I mentioned earlier, I tried reversing the approach. I set the variable's hidden property to false and used an onLoad script to make them invisible. However, the outcome on the HR Case form is different. All fields that are supposed to be hidden, and which work perfectly in the EC Portal, are now all visible on the Case forms with blank values. This is confusing for the fulfillers.

 

This is why I initially set their variable property to hidden=true and then manipulated it using a Client Script.

 

Any help with this issue would be greatly appreciated. Thank you.

 

 

Dnyaneshwaree
Mega Sage

Hello @Arlene H ,

You have not added any logic on HR case table or record for visibility of required variable. You need to add logic for that in client script if no any option present in ui policy to applies it on HR cases.

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hi @Dnyaneshwaree ,

 

Sorry I don't get what you mean by "not added any logic on HR case table or record for visibility of required table".  Can you elaborate on that please.

 

I've attached the EC Portal (which shows variables are visible), and the HR Case form (which shows they are now invisible).

Invisible.PNGVisible.PNG