Home Self-Service Portal - Community

Block end user to change Related Items

Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭

How to set, that end user couldn't change the chosen in the form related Items.

eg. User make an SR by service catalog, when choose the related printer. Now he can go to "My request" and on the "Related items" tab delete the relationship with earlier selected printer. 

Best Answer

Answers

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    NIce job. Thanks. I will try and give a feedback

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    Sure, let me know how it works out! 
  • Gabriel_ArmentaGabriel_Armenta Member IT Monkey ✭
    Hello... Konstantin, One Question... with this custom.js ... It´s Posible Hide All secction "Related Configuration Items" And "Affected Configuration Items"... I want to hide "Configuration item" and "Affected User's Items" drop down from this section and Only show "File Attachments" funcionality ...
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    Hi @Gabriel_Armenta
    Sure, that is possible. Do you want this for only end users or also analysts?

    Please start by reading Cireson's KB: https://support.cireson.com/KnowledgeBase/View/51#/

    This is what you need to do: Copy ServiceRequest.js from CiresonPortal\Scripts\forms\templates\ and paste it into CiresonPortal\CustomSpace\

    Now, edit ServiceRequest.js in a text editor. If you only want to remove the Related Items tab from End Users, scroll down to where it says "DefaultEndUser": { on line 173. Now find line 219, where it says:         
    /*********/<br>/** TAB **/<br>/*********/<br>{<br>&nbsp;&nbsp;&nbsp; name: "RelatedItems",

    and under the customFieldGroupList: [ you can remove each object, so to remove e.g. "Related Configuration Items" and "Affected Configuration Items", you would need to remove all of the code between (and including) line 227 - 234, so the whole tab looks like this:
    /*********/<br>/** TAB **/<br>/*********/<br>{<br>&nbsp;&nbsp;&nbsp; name: "RelatedItems",<br>&nbsp;&nbsp;&nbsp; content: [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; customFieldGroupList: [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name: "FileAttachments",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: "fileAttachments"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; ]<br>}

    You could also move the "File attachements" to the General tab, so you wouldn't have the "Related Items" tab at all, by simple copying the FileAttachments object and inserting it e.g. below "Activities" on line 216, so the general tab would look like this from line 212:
    {<br>&nbsp;&nbsp;&nbsp; name: "Activities",<br>&nbsp;&nbsp;&nbsp; type: "activities"<br>}<br>{<br>&nbsp;&nbsp;&nbsp; name: "FileAttachments",<br>&nbsp;&nbsp;&nbsp; type: "fileAttachments"<br>},

    Then it would display File Attachements on the General tab, right beneath the "Activities" section, and you can remove the whole "Related Items" tab.

    You should be careful what you do here, as it will affect all users of the portal, so it is a good idea to first make the customization on a test environment, and then copy it to production when you ready.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    And if you want to hide it from Analysts also, you can do the exactly same thing by starting at the very top where it says:</code><br><code>
    {<br>&nbsp;&nbsp;&nbsp; "Default": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tabList: [
  • Gabriel_ArmentaGabriel_Armenta Member IT Monkey ✭

    Hello Konstantin... Thanks All... your Information are Gold... really work fine this New Custom Form...
     I remove all RelatedItems secction and the General From redistribute the content and remove information that are replety to obtain an agile form.. add the final result   


    Again... Thanks very Much


    Best Regards


  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    Looks good, glad I could help!
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    edited August 2017

    Konstantin_Slavin-Bo . Thanks for help. It works almost

    I done as you wrote, but only RelatedConfigurationItems are read only. AffectedConfigurationItems are stil able do add.         

    {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name: "RelatedConfigurationItems",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: "relatedItems",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Disabled: true<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name: "AffectedConfigurationItems",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: "affectedItems",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Disabled: true<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, 

    Also is the possiblity to hide "Delete" button in attaments? I try this, but wont works 

    $('.btn.btn-default.k-button.pull-right').hide
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭

    I done as you wrote, but only RelatedConfigurationItems are read only. AffectedConfigurationItems are stil able do add.         

    Weird, it doesn't work here either. I'm not sure why, though? It would be possible to run through it with javascript and disable the individual elements. I don't have the time to do this right now though, but I'll try to look into it at some point.

    Also is the possiblity to hide "Delete" button in attaments? I try this, but wont works 
    $('.btn.btn-default.k-button.pull-right').hide
    First of all, hide is a function, so it needs to called with parentheses: .hide()
    And I would get the element like this instead, so we're sure that we get the correct element:
    ($('button[data-click="remove"]')).hide();
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    edited September 2017
    Does it works on our site? 
    I wrote as below, but button for attachements still shows up.
    app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) {
    	 formObj.boundReady(function () {    
    		if (!session.user.Analyst) {
    		  $('.k-button.k-button-icontext.custom__grid-remove.k-grid-delete').hide(); // works - related items
    		 $('button[data-click="remove"]').hide();  //dont work - attachements
    		 }
    	  });
    	  return;
    	});


Sign In or Register to comment.