Clarity Service Management

Expand all | Collapse all

How to leave an editable field according to the role of the logged user?

Jump to Best Answer
  • 1.  How to leave an editable field according to the role of the logged user?

    Posted 06-07-2018 08:49 AM

    Hi everyone,

     

    I have a little problem and I hope you can help me. There is a field (z_data_prometida) on the detail_cr.htmpl, and I need this field to be editable when a flag in the user's role is active.

    I'll explain my problem in more detail.

    There is a field (z_edita_data_prometida) in the user's role (detail_role.htmpl), which can be marked as "YES" or "NO".

    If the user who is logged in is using this function, and the function is marked "YES", the field (z_data_prometida) of the screen (detail_cr.htmpl) must be editable.

    I don't know what to put in the "PDM_IF" rule.

    <PDM_IF "">
    <PDM_MACRO NAME=dtlDate hdr="Data prometida" attr="z_data_prometida">
    <PDM_ELSE>
    <PDM_MACRO NAME=dtlReadOnly hdr="Data prometida" attr="z_data_prometida">
    </PDM_IF>

    Thanks in advance,

    Sandro

    Gutiscdtjdaniel-bighelini



  • 2.  Re: How to leave an editable field according to the role of the logged user?

    Posted 06-07-2018 12:46 PM

    <PDM_IF "$SESSION.ROLE_ID.z_data_prometida" == "1">

    // code

    </PDM_IF>



  • 3.  Re: How to leave an editable field according to the role of the logged user?
    Best Answer

    Posted 06-07-2018 01:27 PM

    Hi Daniel,

     

    You can not use this code because it is a KEY WORD in the solution.

    I solved the problem.

    I put the following code in <head>.

    <head>
    <script>
    ...
    var editarDataPrometida;

    <pdm_list prefix=r factory=role where="id=$SESSION.ROLE_ID">
              editarDataPrometida = "$r.z_edita_data_prometida";
    </pdm_list>
    ...
    </script>

    </head>

    And the PDM_IF code ...

    <PDM_IF editarDataPrometida != "0">
    <PDM_MACRO name=dtlDate hdr="Data prometida" attr="z_data_prometida">
    <PDM_ELSE>
    <PDM_MACRO name=dtlReadonly hdr="Data prometida" attr="z_data_prometida">
    </PDM_IF>

     

    Thanks!