Hide the variables field in RITM based on created date

Sirri
Tera Guru

Hi all,

 

I have a requirement hide the variables field in RITM based on before created date and If 

Select Application from the list(this is variable in the catalog item) is Foxit PDFEditor.

 

example: which RITM are created before 4-Nov-2023.

Note: In RITM there is a variables section, These all are coming from catalog item.

As per my requirement I want to hide highlighted field in pic

1)AD Group for Computer

2)Uninstall AD Group

 

Please find the attached document.

 

6 REPLIES 6

murali_bsy
Tera Contributor

Hi,

Need more clarification on your question on "before created date"? Is 4th-Nov-2023 is static?

 To implement this, please have a UI Policy or a onload client script, which is applied on 

Applies on Requested Items 
In script section try to have same kind of script.
if(g_form.getValue('select_application_from_backend') == ''Foxit PDFEditor'){  ////Have Choice Value
g_form.setVisible('AD Group for Computer', false);
g_form.setVisible('Uninstall AD Group', false);
 
To fullfill your date Validation, get the system current date with GlideAjax with Script Include.
Have one date variable on catalog Item, have the current date as default with gs.nowdateTime();
Compare on client script as per requirement.

Hi @murali_bsy  ,

1)Select Application from the list 

2)AD_Group_for_Computer

1& 2 variables are comming from catalog item. If we right direct onload client script in sc_req_item table if we use directly your code how that variables values get from that varibles are not created in sc_req_item.then how that variables get from them.

I have tried with your code but not getting.

Please read requirement once again I hope you get understand clearly.

Thank you. 

 

Clara Lemos
Mega Sage
Mega Sage

Hi @Sirri ,

 

You can create a client script on the Requested Item table (sc_req_item).

The client script should be onLoad.

For example:

 

function onLoad() {
	var variable= g_form.getValue('variables.select_application_from_the_list'); // get the value of Select Application from the List
	if(variable=='Foxit PDFEditor'){ // verify if the value is Foxit PDF Editor
		g_form.setVisible('variables.AD_Group_for_Computer',false); // Hide the variable AD Group for Computer when the variable is Foxit PDFEditor
	}   
}

 

 

Where you see 'variables.select_application_from_the_list' you need to add the name of your variable, you might want to check on the catalog item how it was configured, so it will be variables.{the name of your variable} , same thing for the 'variables.AD_Group_for_Computer

Where you  are setting the g_form.setVisible you can add below the same code for the other variable that you need to hide. 

And regarding your date condition just add in the If what you need to check 🙂 

 

If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know

Cheers

Hi @Clara Lemos ,

1)Select Application from the list 

2)AD_Group_for_Computer

1& 2 variables are comming from catalog item. If we right direct onload client script in sc_req_item table if we use directly your code how that variables values get from that varibles are not created in sc_req_item.then how that variables get from them.

I have tried with your code but not getting.

Please read requirement once again I hope you get understand clearly.

Thank you.