# 8. Groups Function

<table border="1" id="bkmrk-calendar-functions-n" style="border-collapse: collapse; width: 99.7531%; height: 470.203px;"><colgroup><col style="width: 17.72%;"></col><col style="width: 12.2677%;"></col><col style="width: 70.0124%;"></col></colgroup><tbody><tr style="height: 70.4219px;"><td style="height: 70.4219px;">[Groups](https://bsa.lynops.com/books/personal-education-management-system/page/groups-table "Groups")</td><td style="height: 70.4219px;"><span style="color: rgb(224, 62, 45);">Not started</span></td><td style="height: 70.4219px;">#### 1.0 Create Group records for new Homeroom record

</td></tr><tr style="height: 63.375px;"><td style="height: 63.375px;">  
</td><td style="height: 63.375px;">*Purpose*</td><td style="height: 63.375px;">*When a new homeroom is added, the group records in PEMS are created.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Trigger*</td><td style="height: 29.7969px;">*Runs only one time, when the new homeroom record is added.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Conditions*</td><td style="height: 29.7969px;">*homeroom status field is active.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Sequence*</td><td style="height: 29.7969px;">*This function runs after a new homeroom record is created*</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;"> </td><td style="height: 57.75px;">Step 1</td><td style="height: 57.75px;">Find Set of all Active Curriculum records.

</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;">  
</td><td style="height: 57.75px;">Step 2</td><td style="height: 57.75px;">Create a Group record for each Curriculum record.

</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;">  
</td><td style="height: 57.75px;">Step 3</td><td style="height: 57.75px;">Set Homeroom = to the new homeroom record created.

</td></tr><tr style="height: 38.375px;"><td style="height: 38.375px;">END</td><td style="height: 38.375px;">  
</td><td style="height: 38.375px;"> </td></tr></tbody></table>

<table border="1" id="bkmrk-groups-not-started-2" style="border-collapse: collapse; width: 99.7531%; height: 480.672px;"><colgroup><col style="width: 17.72%;"></col><col style="width: 12.2677%;"></col><col style="width: 70.0124%;"></col></colgroup><tbody><tr style="height: 99.4844px;"><td style="height: 99.4844px;">[Groups](https://bsa.lynops.com/books/personal-education-management-system/page/groups-table "Groups")</td><td style="height: 99.4844px;"><span style="color: rgb(224, 62, 45);">Not started</span></td><td style="height: 99.4844px;">#### 2.0 Create Group records when a curriculum record has been activated

*note: do not allow new curriculum records to be created with status = active, default must be draft.*

</td></tr><tr style="height: 63.375px;"><td style="height: 63.375px;">  
</td><td style="height: 63.375px;">*Purpose*</td><td style="height: 63.375px;">*When a new curriculum record has been added, group records need to be made for all active homerooms.*</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">  
</td><td style="height: 46.5938px;">*Trigger*</td><td style="height: 46.5938px;">*Runs whenever the status field in the curriculum record has been changed to 'active'*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Conditions*</td><td style="height: 29.7969px;">*curriculum status field has been changed from any value to active.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Sequence*</td><td style="height: 29.7969px;">*This function runs after the curriculum status has been changed.*</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;"> </td><td style="height: 57.75px;">Step 1</td><td style="height: 57.75px;">Find Set of all Active Homeroom records

</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;">  
</td><td style="height: 57.75px;">Step 2</td><td style="height: 57.75px;">Create a Group record for each homeroom record

</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;">  
</td><td style="height: 57.75px;">Step 3</td><td style="height: 57.75px;">Set Curriculum in the group record = to the newly activated curriculum record.

</td></tr><tr style="height: 38.375px;"><td style="height: 38.375px;">END</td><td style="height: 38.375px;">  
</td><td style="height: 38.375px;"> </td></tr></tbody></table>

<table border="1" id="bkmrk-groups-not-started-3" style="border-collapse: collapse; width: 99.7531%; height: 461.672px;"><colgroup><col style="width: 17.72%;"></col><col style="width: 12.2677%;"></col><col style="width: 70.0124%;"></col></colgroup><tbody><tr style="height: 80.4844px;"><td style="height: 80.4844px;">[Groups](https://bsa.lynops.com/books/personal-education-management-system/page/groups-table "Groups")</td><td style="height: 80.4844px;"><span style="color: rgb(224, 62, 45);">Not started</span></td><td style="height: 80.4844px;">#### 3.0 Deactivate Group when home room is deactivated or Curriculum is deactivated

*note: add active/inactive status field to Group and Homeroom*

</td></tr><tr style="height: 63.375px;"><td style="height: 63.375px;">  
</td><td style="height: 63.375px;">*Purpose*</td><td style="height: 63.375px;">*\#When a curriculum is not longer uses or a homeroom no longer operates, deactivate the associated group.*</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">  
</td><td style="height: 46.5938px;">*Trigger*</td><td style="height: 46.5938px;">*Runs whenever the the status field in the curriculum or homeroom record has been changed to 'inactive'*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Conditions*</td><td style="height: 29.7969px;">*Curriculum status field has been changed from any value to inactive.*

*OR*

*Homeroom status field has been changed to inactive*

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Sequence*</td><td style="height: 29.7969px;">*This function runs after the curriculum or homeroom status has been changed.*</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;"> </td><td style="height: 57.75px;">Step 1</td><td style="height: 57.75px;">Find related Group record

</td></tr><tr style="height: 57.75px;"><td style="height: 57.75px;">  
</td><td style="height: 57.75px;">Step 2</td><td style="height: 57.75px;">Set Group record status to inactive.

</td></tr><tr style="height: 38.375px;"><td style="height: 38.375px;">END</td><td style="height: 38.375px;">  
</td><td style="height: 38.375px;"> </td></tr></tbody></table>