Block end user to change Related Items
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
-
Konstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭You can copy
ServiceRequest.js
from\CiresonPortal\Scripts\forms\templates\
into the\CustomSpace\
directory, and then addDisabled: true
to the fields, you need to have as read-only, i.e.:"DefaultEndUser": {<br> [--SNIP--]<br> /*********/<br> /** TAB **/<br> /*********/<br> {<br> name: "RelatedItems",<br> content: [<br> {<br> customFieldGroupList: [<br> {<br> name: "RelatedConfigurationItems",<br> type: "relatedItems",<br> <b><u>Disabled: true</u></b><br> },<br> {<br> name: "AffectedConfigurationItems",<br> type: "affectedItems",<br> <b><u>Disabled: true</u></b><br> },<br> ]<br> }<br> ]<br> }<br> ]<br>} <br>
This will prevent end users from adding new items, but they will still be able to remove already-added items. This part is a little tricky, as I can't find any way to do this OotB, so you will need to add this script inside yourcustom.js
:app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) {<br> formObj.boundReady(function () { <br> if (!session.user.Analyst) {<br> $('.k-button.k-button-icontext.custom__grid-remove.k-grid-delete').hide();<br> }<br> });<br><br> return;<br>});
This will simply hide the "remove" button from the grid from end users.
5
Answers
ServiceRequest.js
from\CiresonPortal\Scripts\forms\templates\
into the\CustomSpace\
directory, and then addDisabled: true
to the fields, you need to have as read-only, i.e.:This will prevent end users from adding new items, but they will still be able to remove already-added items. This part is a little tricky, as I can't find any way to do this OotB, so you will need to add this script inside your
custom.js
:This will simply hide the "remove" button from the grid from end users.
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:
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:
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:
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.
</code><br><code>
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-Bo . Thanks for help. It works almost
I done as you wrote, but only RelatedConfigurationItems are read only. AffectedConfigurationItems are stil able do add.
Also is the possiblity to hide "Delete" button in attaments? I try this, but wont works
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:
I wrote as below, but button for attachements still shows up.