how to restrict the employee to not request more than 2 requests for non catalog learning in VBS
Summary:
I Tried by this code and put it in action chain then associated with event listeners using vb enter but nothing happened
define([
'vb/action/actionChain',
'vb/action/actions',
'vb/action/actionUtils',
], (
ActionChain,
Actions,
ActionUtils
) => {
'use strict';
class request_learn extends ActionChain {
/**
* @param {Object} context
*/
async run(context) {
const { $page, $flow, $application } = context;
const result = await Actions.callRest(context, {
endpoint: 'siteHcmExtensionNonCatalogRequest/getall_learnerLearningRecords',
uriParams: {
q: "AssignmentType='ORA_NON_CATALOG' and LearnerId='" + $application.user.personId + "'",
},
});
if (result.body.count >= 2) {
await Actions.fireNotificationEvent(context, {
summary: 'تنبيه: تم تجاوز الحد المسموح',
message: 'لا يمكنك تقديم أكثر من طلبين للتعلم خارج الدليل (Non-Catalog).',
type: 'error',
0