Make a Checklist readonly/mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2017 06:17 AM
I have created a checklist on form. Now I want to add certain rules on it like to make it visible/read-only or mandatory based on conditions.
As it is not a field of the table, I am unable to use UI policy of any kind of script for fields.
Could anyone please hep me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2017 06:30 AM
Hi Sudipta,
what ever fields you create it should be saved in table, can you go to Configure Dictionary of that field and see on which table it has been stored.
on which form(incident,problem, change etc) you have created the field ?
post a screenshot if possible.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2017 08:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 04:49 AM
This you can achieve using script include and BR something like below
Script Include:
var Test = Class.create();
Test.prototype = {
initialize: function() {
},
isChecked: function(id){
var gr = new GlideRecord("checklist");
gr.addQuery("document", id);
gr.query();
while (gr.next()) {
var gr_checkListItem = new GlideRecord("checklist_item");
gr_checkListItem.addQuery("checklist", gr.sys_id);
gr_checkListItem.addQuery("complete", false);
gr_checkListItem.query();
if (gr_checkListItem.next())
return false;
else
return true;
}
},
type: 'Test'
};
BR:
(function executeRule(current, previous /*null when async*/) {
var res=new Test().isChecked(current.sys_id);
if(res)
gs.addInfoMessage("Checklist is reviewed.");
else
gs.addErrorMessage("Please review the checklist.");
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 07:20 AM
Hi,
after trying with ACL and Client scripts, I found a very simple way.
You have to modify the UI Macro inline_checklist_macro. I added a condition linked to the state of the containing task
inline_checklist_macro
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate>
var isBrowserSupported = (GlideVTBCompatibility.getCompatibility() != 'block');
var isNewUI = gs.getProperty('glide.ui.doctype', 'false') == 'true';
var isNewRecord = true;
if (isBrowserSupported $[AMP]$[AMP] isNewUI) {
var sysID = current.getUniqueValue();
var tableName = current.getTableName();
isNewRecord = current.isNewRecord();
// get the checklist ID for this record
var checklistID = null;
var checklist = new GlideRecord("checklist");
checklist.addQuery("document", sysID);
checklist.addQuery("table", tableName);
checklist.query();
if (checklist.next())
checklistID = checklist.getUniqueValue();
if (current.state == -5 || current.state == 3 ) { // Pending or Closed
var readOnly = "true";
} else {
var readOnly = "false";
}
}
</g2:evaluate>
<body>
<j2:if test="$[!isNewRecord]">
<g:macro_invoke macro="checklist_template" readonly="$[readOnly]" record="$[sysID]"
table="$[tableName]" checklistid="$[checklistID]"/>
</j2:if>
</body>
</j:jelly>
Thanks.
PS: Hit like, Helpful, Correct, if it answers your question.