Mandatory comments when canceling an Access Request

Which IIQ version are you inquiring about?

Version 8.3

Share all details related to your problem, including any error messages you may have received.

Hi!!
I requested access for an identity to an IT role through quicklink manage user access, however I want to cancel that request through the my work >Access Requests section, I look for the identity and press the cancel Request button and I want the comments to be mandatory for perform this action.
Thanks

Hi @Doraly,

This is not possible using OOTB functionality, but it can be custom made :slight_smile:

I see 2 options using JavaScript:

  • Add a new file scripts/custom.js with a function to disable the cancel-button when there is no comment. This custom.js file is included in each page, so need to only work for this particular page.
  • Update the OOTB file identityiq/scripts/sailpoint/web/lcm/CancelWorkflowDialog.js. Here already is a function to cancel the workflow. Within this function it is possible to check if this.commentsField.getValue() is empty and return false if it is empty.

The 2nd option is the simplest to implement, but not advisable as this change will most likely be lost during upgrades/patches and eFixes.

– Remold

2 Likes

Thanks for your answer. I modified the CancelWorkflowDialog.js file, but the changes aren’t reflected in this section or anywhere else. Thanks in advance

hello @Remold,
I am trying to modify the “Cancel Workflow Dialog.js” file to put the mandatory comments, but it does not work, it is as if it were not the file, could you help me review the code with the condition I added

/* (c) Copyright 2008 SailPoint Technologies, Inc., All Rights Reserved. */

/**
 * Simple dialog which allows the user to cancel the workflow given
 * a task result id. The dialog allows the user to enter in comments
 * which will be stored with the cancel audit event
 */
Ext.define('SailPoint.lcm.CancelWorkflowDialog', {
        extend : 'Ext.Window',

    /**
     * @cfg {String} taskResultId ID of the taskResult whose workflow should be canceled
     */
    taskResultId : null,

    /**
     * @private reference to comments field.
     */
    commentsField : null,

    constructor : function(config) {

        this.commentsField = new Ext.form.TextArea({
            fieldLabel:'#{msgs.cancel_access_request_dialog_field_comments}',
            anchor: '90%',
            height:150
        });

        Ext.applyIf(config, {
            modal:true,
            title:'#{msgs.cancel_access_request_dialog_title}',
            width:500,
            height:300,
            layout:'form',
            labelAlign:'top',
            border:false,
            closable:false,
            bodyStyle:'background-color:#FFF;padding:10px',
            items:[
                {xtype: 'box', html:'#{msgs.cancel_access_request_dialog_instr}', style:'margin-bottom:10px',  border:false},
                this.commentsField
            ],
            buttons: [
                {
                    text: '#{msgs.cancel_access_request_dialog_button_cancel}',
                    handler: function() {
                        var self = this; // Captura el contexto actual
                        if (!self.validateComments()) {
                            return false; // Si los comentarios están vacíos, se devuelve false y no se cancela el flujo de trabajo
                        }
                        self.cancelWorkflow();
                    },
                    scope: this
                },
                {
                    text: '#{msgs.cancel_access_request_dialog_button_close}',
                    cls: 'secondaryBtn',
                    handler: function() {
                        this.destroy();
                    },
                    scope: this
                }
            ]
        });

        this.callParent(arguments);
    },

    initComponent : function() {
        this.addEvents('workflowCanceled');
        this.callParent(arguments);
    },

    setMask: function(mask){

         if (mask){
             this.getDockedItems('toolbar')[0].disable();
            this.body.mask(Ext.LoadMask.prototype.msg, 'x-mask-loading');
         } else {
             this.getDockedItems('toolbar')[0].enable();
            this.body.unmask();
         }

        },

    cancelWorkflow : function(){

      this.setMask(true);

      Ext.Ajax.request({
        scope:this,
        url: SailPoint.getRelativeUrl('/rest/identityRequests/cancelWorkflow'),
        success: function(response){
          var respObj = Ext.decode(response.responseText);
          if (respObj.success){
            this.fireEvent('workflowCanceled');
            this.destroy();
          } else {
            error = respObj.errors[0];
            SailPoint.FATAL_ERR_ALERT.call(this,error);
            this.destroy();
          }

          return true;
                          },
                          /**
                           * Throws up a sys err msg. Note that this is not called when
                           * success==false in the response, but if the call returns a 404 or 500.
                           */
                          failure: function(response){
                            // alert(response);
                            this.setMask(false);
                            SailPoint.FATAL_ERR_ALERT.call(this);
                          },
                          params: {requestId:this.taskResultId,comments:this.commentsField.getValue()}
      });
    },
        // FunciĂłn para validar los comentarios
        validateComments: function() {
            var commentText = this.commentsField.getValue().trim();
            if (commentText == '') {
                // Si los comentarios están vacíos, muestra un mensaje de error y devuelve falso
                Ext.Msg.alert('Error', 'Debes ingresar comentarios para cancelar el flujo de trabajo.');
                return false;
            }
            return true; // Si hay comentarios, devuelve verdadero
        }
});

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.