Monitor and Notify When Thresholds are Approached

suvarna sonar2
Tera Contributor

Requirement 1.

We have created below three groups 

1.OpCo_Local_Admin
2. OpCo_Fulfiller_License
3. OpCo_Approver_Admin

 

Requirement 2.

We have created Custom table 'u_license_tracking' with custom field 

1.Company (Reference to `core_company`)

2.Fulfiller_Count (Integer)

3. Approver_Count (Integer)

4.Fulfiller_Budget (Integer)

5. Approver_Budget (Integer)

Write a scheduled script or Business Rule to populate this table with counts (from the OpCo groups mentioned above).

 

Requirement 3.

As a License Manager,
I want a scheduled job to check if the number of users with "Fulfiller" or "Approver" roles is nearing the threshold for each company,
so I can take action before limits are exceeded.

 

Write a scheduled script under System Definition > Scheduled Jobs to:
• Query the u_license_tracking table.
• Compare Fulfiller_Count and Approver_Count to their respective budget.
• Identify companies nearing the thresholds.
2. Create a notification template for threshold warnings.
• Include dynamic fields for company name, counts, and thresholds.
        • If the number of licenses = threshold, the notification should contains "You have no more licenses available", if not, the notification should contains "You have X licenses left to allocate"
3. Trigger the notification to the OpCo_Local_Admin group.
4. Test the script with sample data and ensure notifications are received
 
Acceptance Criteria should be after implementing above requirement.
 
A scheduled job runs weekly to compare the user counts to the thresholds.

• If counts are within 10% of the thresholds, a notification is sent to a designated group or email.

• Notifications include company name, current counts, and thresholds.

• If the number of licenses = threshold, the notification should contains "You have no more licenses available", if not, the notification should contains "You have X licenses left to allocate"

 

 

Could you please help me for above requirement how to calculate threshold and how to trigger notification with scheduled job.

 

 

 

 

 

5 REPLIES 5

gowdash
Mega Guru

You can do something like,

1. Create a Business Rule to update your custom table with Fulfiller Count and Approver Count. This can be created on sys_user_grmember table on insert. Assuming the roles are already added to the group so that it will be inherited to the user upon adding the user to group. You can also double check this by looking up to sys_user_has_role table to query user and role and granted by. Please note that you need to keep on incrementing the counts whenever a new group member is added to the group.

2. Create a flow which runs on a specified duration on this custom table which performs

    - Calculates the 10% of Threshold (I am assuming that you have defined the threshold values somewhere for each company) 

    - If count is < 10% of the threshold, use notification action to send the notification based on your template

    - Else if count => threshold then another notification with a specific content

You can do all these in a single flow.

 

Please mark if this helps

suvarna sonar2
Tera Contributor

Could you please tell me how to calculate threshold and after calculating it how to configuration notification?

Hi, 

You can calculate the threshold by doing simple math something like the below. You need to store the calculated value in a flow variable and use that variable to compare the it against the current license count.

Lets say,

Threshold =  50

10% Threshold = 50 * 0.10 = 5

Current license = 10 ; assuming 10 members with license

 Then the condition (Current license count >  10% of Threshold) will be true. You can trigger a notification.

Similarly you can the logic for other scenario as well.

How to trigger notification to the group using scheduled job?