How to add RIDAC on Program Level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 07:04 AM - edited 05-24-2023 02:02 AM
Related Lists
The related lists "Risk" (risk.top_program) and "Issues" (issue.top_program) are displayed OOTB. For the "Decision" (dmn_decision.top_program) exists one which can be inserted. For Action and Request Change related Lists must be created.
Create a related List
To do this, create a new list under System Definition -> Relationships.
Actions
(function refineQuery(current, parent) {
var output = "parent=" + parent.sys_id;
var encodedQuery = [];
var dmn = new GlideRecord("dmn_demand");
dmn.addQuery("primary_program", parent.sys_id);
dmn.query();
while (dmn.next()) {
encodedQuery.push("parent=" + dmn.sys_id);
}
var prj = new GlideRecord("pm_project");
prj.addQuery("primary_program", parent.sys_id);
prj.query();
while (prj.next()) {
encodedQuery.push("parent=" + prj.sys_id);
}
if (encodedQuery.length > 0) {
var encodedQueryStr = encodedQuery.join("^OR");
current.addEncodedQuery(output + "^OR" + encodedQueryStr);
} else {
current.addEncodedQuery(output);
}
})(current, parent);
Request Change
(function refineQuery(current, parent) {
var output = "parent=" + parent.sys_id;
var encodedQuery = [];
var dmn = new GlideRecord("dmn_demand");
dmn.addQuery("primary_program", parent.sys_id);
dmn.query();
while (dmn.next()) {
encodedQuery.push("parent=" + dmn.sys_id);
}
var prj = new GlideRecord("pm_project");
prj.addQuery("primary_program", parent.sys_id);
prj.query();
while (prj.next()) {
encodedQuery.push("parent=" + prj.sys_id);
}
if (encodedQuery.length > 0) {
var encodedQueryStr = encodedQuery.join("^OR");
current.addEncodedQuery(output + "^OR" + encodedQueryStr);
} else {
current.addEncodedQuery(output);
}
})(current, parent);
Enable Related Links
The UI action "Convert to RIDAC" contains the following condition:
!current.isNewRecord() && current.canWrite() && gs.hasRole('project_manager, demand_manager') && (current.risk_state == '-5' || current.risk_state == '1' || current.risk_state == '2') && new RidacHelper().checkParentTask(current.task)
Therefore the script include "RidacHelper" respectively the function "checkParentTask" has to be extended as follows:
else if(parentTask.getRefRecord().instanceOf('pm_program'))
return true;
Insert module
Under System Definition -> Modules insert a "View RIDAC" for Program Level:
Arguments
&sysparm_fixed_query=from_task.sys_class_name=pm_program