CA Service Management

  • 1.  Explicitly setting a role in htmpl

    Posted Jun 12, 2017 06:18 AM

    We have a bit of a unique requirement and I would like to know if it is possible to set a role upon login, i.e. hard coded in the HTMPL. Using the last login or the default role for the access type will not satisfy this as this will be accessed by different webengines and thus different forms.

     

    The 2 places where i can potentially see that this could be done is the welcome and ahdtop htmpl.  is it possible to force a role through form customisation?



  • 2.  Re: Explicitly setting a role in htmpl

    Posted Jun 12, 2017 07:30 AM

    Hi,

    interesting question..

    What will be your criteria to define witch role to be used?

    /J



  • 3.  Re: Explicitly setting a role in htmpl

    Posted Jun 12, 2017 07:57 AM

    This is a little complicated. The contacts sit at the top tenant level, they have access to 2 sub tenants each with and employee interface.  The customer wants a separate means to enter the 2 employee interfaces (hence the separate webengines to provide separate entry points), but they don't want to be able to switch between the 'employee roles' .



  • 4.  Re: Explicitly setting a role in htmpl

    Posted Jun 12, 2017 07:34 AM

    Quickly looking, you may look to submit the role_change form using a onload event and some js to process your logic

    not really nice but may eventually do the trick

    /J



  • 5.  Re: Explicitly setting a role in htmpl

    Posted Jun 12, 2017 08:03 AM

    To be honest there isn't any clever logic required just a means to force the role on login. We can make the role change selector on the top right corner read only, but have been having trouble forcing a role.

     

    Am I correct in thinking it would be best to do this after the ahdtop.htmpl has loaded otherwise it will default back to OOTB functionality which is the user preference/default access type role?

     

    thanks



  • 6.  Re: Explicitly setting a role in htmpl

    Posted Jun 12, 2017 08:34 AM

    Hi Jagadish - jmayer is correct, there is no way to force a role within a form.  The roles drive the forms, but the forms cannot drive the roles - it only works one way.  The reason for this is that some roles are licensed (via the access type they are related to) and some are not.  This is the only way for the KPIs to work properly to know what is licensed and what is not.  If we were to allow you to force-change a role from within a form, it would be underneath the session level, which would create rogue and inaccurate KPIs for license usage.  

    Thanks,
    Jon I.



  • 7.  Re: Explicitly setting a role in htmpl
    Best Answer

    Posted Jun 14, 2017 09:39 AM

    whilst there isn't a way to force the a role within the htmpl.  Another way which was recommended by Michael Muller was to pass the role we wanted in the URL.

     

    http://localhost/CAisd/pdmweb.exe?OP=DISPLAY_FORM+HTMPL=set_role.htmpl+KEEP.new_role=12345

     

    -then within the code to pick up this argument,

    -check the user has access to the role

    -if the role that is being requested is what it is currently set to then to rewrite the URL

    - if it is a role that is not recognised to put up an alert box and logout.

     

    This seems to work fairly well and might be useful for someone who has an obscure requirement.