Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
(function execute(inputs, outputs) {
// ... code ...

//Get Source ids from exisitng Attestation;
//Check if an assessable record exists for all attestations in the group if not, throw an error message.
var sources = '',
state = true;
asmtmetricType = inputs.metricType;
asmtAssignee =inputs.AttestationAssignee.sys_id;
assessmentList =inputs.AttestationList.trim();
var asmt = new GlideRecord("asmt_assessment_instance");
asmt.addQuery("sys_id", "IN", assessmentList);
asmt.query();
while (asmt.next()) {
if ((asmt.state == "complete" || asmt.state == "canceled")) {
outputs.out = "can't proceed, Attestation states are in Complete or Canceled, Please review.";
return;
}
//check if assessable record exist
var assessableRecord = new GlideRecord("asmt_assessable_record");
assessableRecord.addQuery("source_id", asmt.sn_grc_item);
assessableRecord.query();
if (assessableRecord.next()) {
sources = sources + "," + asmt.sn_grc_item;
} else {
outputs.out = "can't proceed, Assesssable record doesn't for this inntance please " + asmt.number + " review";
return;

}
}
sources = sources.slice(1); //Comma separated source sys_ids

//Create Grouped Attestation.
var result = new global.AssessmentUtils().createAssessments(asmtmetricType, sources + '', asmtAssignee, '');

//set grouped assessmemt as parent to all the instance
var asmtFinal = new GlideRecord("asmt_assessment_instance");
asmtFinal.addQuery("sys_id", "IN", "1d66c941c3e39a10c3dcd8477d0131da,ff6a5ad1c399d610c3dcd8477d0131d0");
asmtFinal.query();
while(asmtFinal.next()){
asmtFinal.setValue("sn_grc_parent", result.split(',')[0]);
asmtFinal.update();
}
asmtFinal.initialize();
asmtFinal.get(result.split(',')[0]);
asmtFinal.setValue("sn_grc_group_type", "grouped"); // //set response type on Grouped attestation as "grouped"
asmtFinal.update();

outputs.out = result.split(',')[0]; //retun the grouped attestation instance id.

})(inputs, outputs);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**Create a flow action with the inputs below:**
<img width="1656" height="633" alt="image" src="https://github.com/user-attachments/assets/fbb34ee0-eae8-4d46-ad3b-492554cd5ad5" />

Add the script from action.js file

**Test and publish the action.**
<img width="1655" height="252" alt="image" src="https://github.com/user-attachments/assets/7a973573-016d-45a7-ba96-e8e4a495fbaf" />
**Plug this into the appropriate flow where you need to group the attestation.**
<img width="714" height="298" alt="image" src="https://github.com/user-attachments/assets/b82612fa-bbb7-4375-ba54-13fe2286b582" />

**Output:**

**List of Assessments**
<img width="1655" height="252" alt="image" src="https://github.com/user-attachments/assets/297be503-ee0c-4495-baca-5693f9a3fa42" />

<img width="962" height="566" alt="image" src="https://github.com/user-attachments/assets/c79e4dc3-77ab-47b5-89e9-030972d01351" />

**Flow Context:**
<img width="1469" height="463" alt="image" src="https://github.com/user-attachments/assets/b9c894af-f39d-4f72-a606-473b2d757fdf" />

**Grouped Assessment:**
<img width="1252" height="694" alt="image" src="https://github.com/user-attachments/assets/b9ca0d68-dd9d-4381-97b7-2cfbec638f99" />
Loading