Clear or hide empty value of unused variable on sc_req_item (variable editor)form

naruemol
Mega Contributor

I create catalog item via service catalog >> maintain items. There's a variable for user to choose number of line to input data. Then I use catalog UI policies to manage to hide variables on screen as necessary. From captured screen : if "Add Hardware Detail" variable is "1" , there will be one line of "Hardware" and "Model" variables. If "Add Hardware Detail" variable is "2" , there will be 2 lines of "Hardware" and "Model" variables and so on. Maximum is 3.   I use 3 catalog UI policies to control hide/show . PROBLEM --> If I choose 2 , complete input data in 2 lines . Before submit , I change to 1 and input/correct only 1 line.   Screen on the catalog is fine . After submit ,request is created in sc_request and sc_req_item.   But the "variable editor" section under sc_req_item shows every line of variables including line which was hidden on catalog screen. This makes incorrect information for fulfiler to work with. I thought catalog UI policies should handle this , but it didn't . How can I clear these unused lines out   ?  

find_real_file.png

find_real_file.png

find_real_file.pngcatalog UI policy.png

"Add Hardware Detail" variable is "1"

1 ACCEPTED SOLUTION

Hi Ken,


I attached 4 images. Hope you can see all. I notice there are blank pages in my question. Anyway , I re-attach here.  


I hide unused fields with 3 Catalog UI Policies as "Add Hardware Detail" value can be 1,2,3 . There are every fields In each Catalog UI Policies but setting False for unused fields .


I'll try the client script as suggested. Any other comment , please share.



catalog first page.pngRITM page.pngcatalog UI policy.pngcatalog final page.png


View solution in original post

2 REPLIES 2

kenappell
Kilo Guru

The easiest way to do this would be to create an "onChange" client script for the "Add Hardware Detail" variable and clear the unused lines based on what is entered in this variable. BTW, most of the screen shots above are not loading for me, so not sure what else is depicted. To hide the unused fields, write Catalog UI Policies to only show those fields based on the same variable.



Another way to do it would be to add a script to the workflow to clear unused variables. This would be a catch-all to ensure bad data does not get entered into the ticket.


Hi Ken,


I attached 4 images. Hope you can see all. I notice there are blank pages in my question. Anyway , I re-attach here.  


I hide unused fields with 3 Catalog UI Policies as "Add Hardware Detail" value can be 1,2,3 . There are every fields In each Catalog UI Policies but setting False for unused fields .


I'll try the client script as suggested. Any other comment , please share.



catalog first page.pngRITM page.pngcatalog UI policy.pngcatalog final page.png