Skip to content

Commit ef3226b

Browse files
authored
Group similar assessments using flow designer action native UI (#1813)
* Create script.js * Delete Background scripts directory * Create Convert comma separated values in string to columns * Delete Convert comma separated values in string to columns * Create MID Server availability inside MID cluster.js * Create reame.md * Update MID Server availability inside MID cluster.js * Delete Flow Actions/Check MID Servers status inside MID Server cluster directory * Create FlowAction.js * Create readme.md
1 parent 5428969 commit ef3226b

File tree

2 files changed

+69
-0
lines changed
  • Specialized Areas/Flow Actions/Group Similar Assessments Using Flow Designer Action Native UI

2 files changed

+69
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(function execute(inputs, outputs) {
2+
// ... code ...
3+
4+
//Get Source ids from existing Attestation;
5+
//Check if an assessable record exists for all attestations in the group if not, throw an error message.
6+
var sources = '';
7+
var asmtmetricType = inputs.metricType; //Assessment metric type sys_id
8+
var asmtAssignee =inputs.AttestationAssignee.sys_id.toString(); //Assessment assignee.
9+
var assessmentList =inputs.AttestationList.trim(); //comma separated individual assessment.
10+
11+
var asmt = new GlideRecord("asmt_assessment_instance"); //Assessment instance table
12+
asmt.addQuery("sys_id", "IN", assessmentList);
13+
asmt.query();
14+
while (asmt.next()) { //Need this while loop to check 1)check state and Assessable record.
15+
if ((asmt.state == "complete" || asmt.state == "canceled")) {
16+
outputs.out = "can't proceed, Attestation states are in Complete or Canceled, Please review.";
17+
return;
18+
}
19+
//for each assessment check if assessable record exist
20+
var assessableRecord = new GlideRecord("asmt_assessable_record"); //assessment assessable table
21+
assessableRecord.addQuery("source_id", asmt.sn_grc_item);
22+
assessableRecord.query();
23+
if (assessableRecord.next()) {
24+
sources = sources + "," + asmt.sn_grc_item;
25+
} else {
26+
outputs.out = "can't proceed, Assesssable record doesn't for this inntance please " + asmt.number + " review";
27+
return;
28+
}
29+
}
30+
sources = sources.slice(1); //Comma separated source sys_ids where assessment exist
31+
32+
//Create Grouped Attestation using below api
33+
var result = new global.AssessmentUtils().createAssessments(asmtmetricType, sources + '', asmtAssignee, '');
34+
35+
//set grouped assessmemt as parent to all the instance
36+
var asmtFinal = new GlideRecord("asmt_assessment_instance");
37+
asmtFinal.addQuery("sys_id", "IN", assessmentList);
38+
asmtFinal.query();
39+
while(asmtFinal.next()){
40+
asmtFinal.setValue("sn_grc_parent", result.split(',')[0]);
41+
asmtFinal.update(); //set parent on to the each assessment
42+
}
43+
44+
outputs.out = result.split(',')[0]; //return the grouped attestation instance id.
45+
46+
})(inputs, outputs);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Create a flow action with the inputs below:**
2+
<img width="1483" height="712" alt="image" src="https://github.com/user-attachments/assets/08dbdce3-a189-4a29-af81-49f6c0fcccae" />
3+
4+
5+
Add the script from action.js file
6+
7+
**Test and publish the action.**
8+
<img width="1655" height="252" alt="image" src="https://github.com/user-attachments/assets/7a973573-016d-45a7-ba96-e8e4a495fbaf" />
9+
**Plug this into the appropriate flow where you need to group the attestation.**
10+
<img width="714" height="298" alt="image" src="https://github.com/user-attachments/assets/b82612fa-bbb7-4375-ba54-13fe2286b582" />
11+
12+
**Output:**
13+
14+
**List of Sample Assessments**
15+
<img width="1655" height="252" alt="image" src="https://github.com/user-attachments/assets/297be503-ee0c-4495-baca-5693f9a3fa42" />
16+
17+
<img width="962" height="566" alt="image" src="https://github.com/user-attachments/assets/c79e4dc3-77ab-47b5-89e9-030972d01351" />
18+
19+
**Flow Context:**
20+
<img width="1469" height="463" alt="image" src="https://github.com/user-attachments/assets/b9c894af-f39d-4f72-a606-473b2d757fdf" />
21+
22+
**Grouped Assessment:**
23+
<img width="1252" height="694" alt="image" src="https://github.com/user-attachments/assets/b9ca0d68-dd9d-4381-97b7-2cfbec638f99" />

0 commit comments

Comments
 (0)