Read Only Variables in a Variable Editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 05:05 AM
I've seen that many people have been asking how to set to read only all the variables within the variable editor of an incident or any other task.
The solution is to modify (or create) the Formatter that shows the variable editor, for instance "Incident Variable Editor".
This formatter is using an UI macro called "com_glideapp_questionset_default_question_editor". If we open it we see the following code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="scripts/js_includes_catalog.js" includes="true"/>
<g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
<g2:render_component componentName="com.glideapp.questionset.DefaultQuestionEditor" />
</j:jelly>
We only need to add the following line before the g2:render_component, to have our variable editor in read only mode:
<j2:set var="jvar_questionset_read_only" value="true" />
Here the result:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="scripts/js_includes_catalog.js" includes="true"/>
<g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
<j2:set var="jvar_questionset_read_only" value="true" />
<g2:render_component componentName="com.glideapp.questionset.DefaultQuestionEditor" />
</j:jelly>
I hope this solution helps you!
Cheers,
Roberto
- 2,861 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 08:06 AM
Hi Roberto,
Thank you for the quick and easy change.
Just a reminder to those who do are thinking about doing this, you are modifying an OOB UI macro that carries with it upgrade risks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2016 08:33 AM
How can we do this for marketing request form.
Thanks,
Y Anjaneyulu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 08:10 PM
Hi ctomasi,
Is there a better way to do this? That is, to lock all variables shown in the Variable Editor formatter? I know this can be done with Catalog UI Policies, however that would require a policy per Catalog Item or Variable Set etc. I'm looking for a solution to lock down the Variable Editor and make it read only for all Requested Item forms regardless of which Catalog Item they are linked to.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2018 03:35 PM
Perfect! Thank you!
