How to hide "Send Email" from the "Tasks" column on the IR, SR, etc. form/page?
Hello,
I am trying to hide "Send Email" from the "Tasks" column on the IR, SR, etc. form/page to force the usage of "Comments" to document work. I want everything IT is doing to be captured by documenting in "Comments".
I tried adding the script part in this link ... https://community.cireson.com/discussion/451/hide-send-email-link-for-ad-groups-in-incident ... to our custom.js file, but it doesn't seem to be having he desired affect.
FYI ... I've reastarted Cache Builder, IIS, etc. after adding the custom script part.
Any ideas?
Thanks!
///////////////////////////////////////////////////////////////////////////////////////////////
// Hide 'Send Email' Task from ticket form.
function HideSendMailForGroups(){
var userid = session.user.Id;
//Define the groups which can't see the "send email" link here:
// var stsgroups = ["3rdL_AD_Group","2ndL_AD_Group","1stL_AD_Group"];
// No groups should see 'Send Email'.
var stsgroups = [""];
$.ajax({
url: "/api/V3/User/GetUsersGroups",
data: {id: userid},
type: "GET",
success: function (groups) {
for ( i = 0 ; i < groups.length ; i++ ) {
if (contains(stsgroups,groups[i].UserName)) {
$( ".taskmenu li:contains('Send Email')" ).hide();
}
}
}
});
}
///////////////////////////////////////////////////////////////////////////////////////////////
Best Answers
-
Geoff_Ross Cireson Consultant O.G.
Hi @Brett_Etzel
It appears you are defining the function but never calling it. YOu might have missed a bit of that solution. However, if you want to hide for everyone, you can simplify that a lot by removing all the groups stuff.
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { formObj.boundReady(function(){ //Hide the task $(".taskmenu li:contains('Send Email')" ).hide() ; }); return; }); app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) { formObj.boundReady(function(){ //Hide the task $(".taskmenu li:contains('Send Email')" ).hide() ; }); return; });
This hides it on Incident and Service Request.
It does not support other languages other than English, let me know if you need to do that and we can figure it out together.
Geoff
6 -
Geoff_Ross Cireson Consultant O.G.
Hi Brett,
I've always done this with the version.json file. Carrie mentions this in the other post.
However, she mentions the danger here in that if you increment and then upgrade the portal and you already have that version number added manually, you won't get the upgraded files.
eg The version from version.json is 5. To force the browsers to grab new files from the server you increase to 6. This will have the desired effect. However, then you upgrade and the upgrade also sets the version.json value to 6. Nothing will change and the browsers won't get the updated files from the upgrade.
Here's the magic...
Decrease the version!!!
eg The version from version.json is 5. To force the browsers to grab new files from the server you decrease to 4. This will still have the desired effect. However, when you upgrade, the upgrade will set the version.json value to 6. The browsers will know to get the updated files from the upgrade.
Its not an increase of this number that forces the browsers to get new files, its just a change in the value. Decrease works just as well and won't break anything!
Enjoy.
5
Answers
Hi @Brett_Etzel
It appears you are defining the function but never calling it. YOu might have missed a bit of that solution. However, if you want to hide for everyone, you can simplify that a lot by removing all the groups stuff.
This hides it on Incident and Service Request.
It does not support other languages other than English, let me know if you need to do that and we can figure it out together.
Geoff
Hi Geoff,
Thank you very much for the reply!
I don't make changes to the custom space all that often, so I'm likely missing the obvious. I generally get help from a Cireson consultant or support rep.
I added the script-part you provided in the custom.js file, saved, restarted IIS (+ dependencies), including the Cache Builder. I then tested the IR and SR forms, however, Send Email still shows.
Apologizes for missing the obvious.
Brett
Brett, no problems, we'll get it sorted. None of that stuff actually needs to be restarted, (but it doesn't hurt). The one thing that does need doing is clearing browser cache. An IIS restart should trigger that but to be sure, can you try in Incognito mode.
Geoff
That did the trick. Thanks again, Geoff!
That definitely rings a bell, and I now recall needing to frequently flush browser cache when customizing the Portal with the Cireson consultants and support reps (a couple years ago).
Relating cached content. Is there a Cireson-approved method for shortening content caching from the IIS server's perspective? Ideally, I'd set a global limit for the Portal on content caching. If I can reduce that cache, customizations can take affect without asking end users to flush browser cache.
I did a quick Cireson Community search and didn't find anything obvious, but maybe Cireson addresses that differently.
If Cireson has no special way of achieving this, maybe it's done in the Web.Config file? I found this for the site ... https://docs.microsoft.com/en-us/iis/manage/managing-performance-settings/configure-iis-7-output-caching ... but if there is a best practice approach to use with the Portal, I'd rather go that route.
Thanks, Brett
Hi Brett,
I've always done this with the version.json file. Carrie mentions this in the other post.
However, she mentions the danger here in that if you increment and then upgrade the portal and you already have that version number added manually, you won't get the upgraded files.
eg The version from version.json is 5. To force the browsers to grab new files from the server you increase to 6. This will have the desired effect. However, then you upgrade and the upgrade also sets the version.json value to 6. Nothing will change and the browsers won't get the updated files from the upgrade.
Here's the magic...
Decrease the version!!!
eg The version from version.json is 5. To force the browsers to grab new files from the server you decrease to 4. This will still have the desired effect. However, when you upgrade, the upgrade will set the version.json value to 6. The browsers will know to get the updated files from the upgrade.
Its not an increase of this number that forces the browsers to get new files, its just a change in the value. Decrease works just as well and won't break anything!
Enjoy.
Great, I tried this (reducing the version number as described above) and it seems to have worked well.
Thank you Geoff!
This can now be done easily with the new addin "Hide OOB tasks" introduced in 10.2.0 or higher in latest branch :)