You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

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',

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!