Cireson Portal
Dear All,
I would like to hide support group on the incident form when a pull down equals a value.
Is this possible?
Kind Regards
Daniel
Best Answer
-
Simon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
i have found a solution which should work 1:1 for you.
All you have to do is changing the ID of the line
if (viewModel.Classification.Id == '580f8b0b-e8af-2ea5-fb69-1c58e4d24788')
to the id you have gotten through the console. The .parent() hides the complete support group label.
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { //Incident OnReady formObj.boundReady(function () { //Code here will run when the Incident form has loaded. //Get the AutoClose label var autoCloseLabel = $(".form-group label[for='TierQueue']"); if (viewModel.Classification.Id == '580f8b0b-e8af-2ea5-fb69-1c58e4d24788'){ autoCloseLabel.parent().hide(); } else{ autoCloseLabel.parent().show(); } return; }); //Incident Classification changed formObj.boundChange("Classification", function () { //Code here will run every time the Classification category picker is changed. //Get the Network Description label var autoCloseLabel = $(".form-group label[for='TierQueue']") //If Classification 'Reset Password / SAP' is selected if (viewModel.Classification.Id == '580f8b0b-e8af-2ea5-fb69-1c58e4d24788') { //Show Auto Close label and field autoCloseLabel.parent().hide(); //Set Auto Close Label red }else{ //Reset back to default if another category is selected autoCloseLabel.parent().show(); } }); return; });
For me it works the way you want it
1
Answers
We do the same with an Auto Resolve Checkbox for certain incident classifications.
You can edit the script for your needs.
Ofc don't forget to add it to the custom.js
Is there anyway to simify this?
I just need it to hide the support group tierqueue when classification == a value?
I don't understand the coding here.
@CaterhamITSupport
The thing is, you need both functions:
The first is for the situation where the classification, which triggers the hiding, is set when you open the incident.
The second is for the situation where you change the classification to the one which triggers the hiding.
I am not rly good with javascript so I cannot tell you if you can simplify it, but maybe someone else knows that ;)
I tried this code and it didnt work for me, thank you though.
@CaterhamITSupport Have you just copied it 1 to 1?
2. Have you changed the label in this to the following in both functions?
3. Have you saved this .js file with the code inside your customspace folder and imported it into your custom.js file? :)
Without that nothing will happen ;-)
I am trying to find the classification ID in number 1. How is best to get this unique ID? I have tried to find it in SQL on the DWH but it doesnt work with this value and crashes the incident form.
@CaterhamITSupport
there are some ways to accomplish that.
You could just go into an incident and choose the classification, which woud trigger the hiding of the support group label. Then press F12 on your keyboard, so the console opens.
Inside the terminal just write: pageForm.viewModel.Classification.Id
The following should appear:
This is the ID(GUID) of your classification, which you have to insert into the block i pasted before.
Are you referring to doing this in the console or portal?
@CaterhamITSupport Everything in the portal.
F12 opens the Browser console, not the SCSM Console ;-) Sry if that was confusing
Is this using Edge or Chrome?
Works in every browser. I would recommend using Edge for that
I think with your direction I may have just worked it out.
This does sort of work. I need it to hide the text box and label. It also doesnt work if other classifications are selected. A step in the right direction thank you.
@CaterhamITSupport
i have found a solution which should work 1:1 for you.
All you have to do is changing the ID of the line
to the id you have gotten through the console. The .parent() hides the complete support group label.
For me it works the way you want it
This works!
Really appreciated the help with this.
Kind Regards
Daniel
How would i change it from hiding a enum to a user picker?
Now that you have gotten a full working solution, I'd say you just try it yourself. That's the best way to implement such things by yourself.
Ok thanks for the help, the code is causing some minor issues with required fields on the page now. I will take a closer look into this.