Untitled

 avatar
unknown
plain_text
a month ago
1.7 kB
3
Indexable
var rsSmartCardUtils = Class.create();
rsSmartCardUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    fetchSmartCardInfo: function(smartCard) {
        smartCard = smartCard || this.getParameter('sysparm_smartCard'); // Retrieve parameter if not provided
        var smartCardInfo = {
            position: "",
            occupational_code: "",
            licensed_occupational_group: "",
            personal_prescriber_code: "",
            prescription_code: "",
            individual_it_properties: "",
            care_assignment: "",
            department: "",
            authorization_level: ""
        };

        var grCard = new GlideRecordSecure('u_cmdb_ci_smart_card'); // Use GlideRecordSecure
        if (grCard.get(smartCard)) {
            gs.info(grCard.u_position);

            smartCardInfo.position = grCard.u_position;
            smartCardInfo.occupational_code = grCard.u_occupational_code;
            smartCardInfo.licensed_occupational_group = grCard.u_licensed_occupational_group;
            smartCardInfo.personal_prescriber_code = grCard.u_personal_prescriber_code;
            smartCardInfo.prescription_code = grCard.u_prescription_code;
            smartCardInfo.individual_it_properties = grCard.u_individual_it_properties;
            smartCardInfo.care_assignment = grCard.u_care_assignment;
            smartCardInfo.department = grCard.u_department;
            smartCardInfo.authorization_level = grCard.u_authorization_level;
        } else {
            gs.warn('No record found or insufficient access in u_cmdb_ci_smart_card for ID: ' + smartCard);
        }

        return smartCardInfo;
    },

    type: 'rsSmartCardUtils'
});
Leave a Comment