Skip to Content

User Authentication using iCommand


I would like to illustrate here how to use an iCommand Display Template to Audit the role of the User such that the command can be carried out only by the Users with the specified role.


Certain operations like Delete/Update etc would be permitted only for certain roles of MII .

Subject knowledge
  • iCommand

  • javascript


There are 2 approaches to do this. One is using Javascript and the other is by directly setting the iCommand display template accordingly. 

Approach1:Using Javascript


1.I am using a simple insert functionality to explain this.

On clicking the Submit Button the entered value will be inserted into the Database. This insert action is permitted only for a User with the role XMII Administrators


2.  The Following function is assigned to the onclick parameter of the Submit button.

         function updateaftercheck()
          var role=”XMII Administrators”
            //after it is executed till here the Message Pops up
              va =T1.value
              document.InsertCommandAPP.getQueryObject().setParam(1,va );

         The part in bold is the code used to set the role Audit .

It makes sure that only Users with the role (in this case) “XMII Administrators” can perform the action.

3.  When you click on the Submit button the following Pop Up Message appears.


4.   The User has to enter his login credentials here. If it matches to the credentials of a User with role XMII Administrators in this case then the action is permitted. Otherwise the following error message is obtained.


Approach1:Setting Audit Directly in the iCommand

1. Open the iCommand Display template used for the action.

2.  Select the Following options in the iCommand


3.The action will be permitted only for Users with XMII Administrators Role .It will Pop up the same Message from the front end as shown above under the approach using Javascript.


Be the first to leave a comment
You must be Logged on to comment or reply to a post.