09-09-2024 01:28 PM
Hello, I would like to know if with unity script, events, javascript or some dynamic means I can make depending on the value of a field validate the other fields as read-only, it is important to mention that these fields are related by a filter.
I require that if my State field = History the object is blocked and does not allow editing, deleting or adding.
I have searched in unity script, javascript and other means but I can't identify anything that will help me with this.
Additionally, I would like to know if there is any way to prevent the options marked in red from appearing, I don't like them visually.
Thank you very much for any information you can give me.
09-10-2024 04:21 AM
Hi Fabian,
For this kind of task you are looking at Javascript.
I am not aware of any means to make individual fields in an embedded filter read only.
Also I am not aware of a way to make the Open Object button dissapear.
Also, it does not look like your filter is editable, as it does not show the Edit button. I assume that Edit mode is not selected in the Advanced tab.
If you want to manipulate the buttons on the filter, you can access each button through Javascript and show/hide it.
If you want to make the whole embedded filter read only, you can do the following:
let currentView = Screen.CurrentView;let filter = currentView.Filters('name of filter');let buttons = filter.Buttons;let btnAdd = buttons.find(b => b.Name = 'Add');let state = currentView.Fields('State'); if(state.Value == 'History') { btnAdd.Hidden = true;}
I would run this in the OnLoad script on the view.
09-10-2024 04:21 AM
Hi Fabian,
For this kind of task you are looking at Javascript.
I am not aware of any means to make individual fields in an embedded filter read only.
Also I am not aware of a way to make the Open Object button dissapear.
Also, it does not look like your filter is editable, as it does not show the Edit button. I assume that Edit mode is not selected in the Advanced tab.
If you want to manipulate the buttons on the filter, you can access each button through Javascript and show/hide it.
If you want to make the whole embedded filter read only, you can do the following:
let currentView = Screen.CurrentView;let filter = currentView.Filters('name of filter');let buttons = filter.Buttons;let btnAdd = buttons.find(b => b.Name = 'Add');let state = currentView.Fields('State'); if(state.Value == 'History') { btnAdd.Hidden = true;}
I would run this in the OnLoad script on the view.
09-10-2024 07:49 AM
Hello Stefan , thank you very much for your help, your code helped me to hide the buttons and it helps a lot, it is not the right solution but it does help and I used it.
I do not have the edit button marked because the user is forced to edit in the object view and not edit inline, the problem with hiding the buttons is that the user can still navigate or go to related views and it is something that I have not discovered how to remove (I marked it in red in the image of the question) so even if I hide the buttons the user can still perform actions in the related view and controlling it with hiding code for each view is tedious.
so what I did was use attribute restrictions and this controls those permissions and I accompanied it with your code to hide the buttons for a cleaner view (even if the user saw them it would not allow him to perform the action).
Thank you very much for your help, you have saved my day.
09-10-2024 08:40 AM
Just did a bit of digging and for cancelling the opening of related items you can set the property CancelOpenRelatedObjects = true on the filter (filter.CancelOpenRelatedObjects = true).
The documentation for Javascript can be found in the "WorkView Javascript Client Side API Documentation" chapter of the WorkView MRG, there you can find all properties and methods available.
Also for testing Javascript it is useful to use the console from the browser developer tools.
If you use Web Client, just press F12 in Chrome or there are similar shortcuts in other browsers.
If you use Unity Client, you need to enable the developer console in the obunity.exe.config file by adding this key under <appSettings>:
<!-- Enable debugging -->
<add key="enableDevTools" value="true" />
Then you can press Ctrl-Shift-F12 and you will get the developer console.
In the console you can test immediately what something does:
09-10-2024 09:57 AM
Hello Stefan
Incredible, thank you very much, I don't really use the web client but opening the console from the unity client is something that will help me a lot, I will try the code to hide but with this information you have given me all the resources to continue, thank you.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.