CA Service Management

 View Only
  • 1.  PDM_LIST menubar_sd.htmpl condition

    Posted Sep 20, 2016 11:11 AM

    Guys,

     

    I need to show the "New change order" menu item only if the user is a member of a particular group.

     

    I followed the topic Restrict who can see a field in Service Desk to customize the condition in the "menubar_sd_l1_analyst.htmpl" but when I publish the change a syntax error is displayed in the log:

    Unable to receive record for PDM_LIST at menubar_sd_l1_analyst.htmpl[138]: syntax error, unexpected FROM at FROM

     

    The code:

     

    <PDM_LIST FACTORY=grpmem WHERE="member=U'$cst.id' and (group.last_name = 'CORPORATIVO')" PREFIX=special>
    <PDM_SET args.PodeVer="Yes">
    </PDM_LIST>
    if ("$args.PodeVer" == "Yes") {
    <PDM_MACRO name=menuItem label="New_Change_Order..." function="ahdtop.create_new('chg',0)" hotkey="h">
    <!PDM_MACRO name=menuItem label="New_Change_Order_from_Template" function="ahdtop.create_new('chg',1)" hotkey="w">
    }

     

    Can anyone help me?!



  • 2.  Re: PDM_LIST menubar_sd.htmpl condition

    Posted Sep 20, 2016 02:13 PM

    Hi Diego, 

    Unfortunately out of the box we dont have any trigger to drive that by the group.  Something like that would be restricted based on the role and form group (which is assigned to each role).

    Thanks,

    Jon I.



  • 3.  Re: PDM_LIST menubar_sd.htmpl condition

    Posted Sep 20, 2016 03:45 PM

    Oh god!!! =´(

     

    Thanks for answering, Jon_Israel!!!

     

    I will think in some way to do this!!



  • 4.  Re: PDM_LIST menubar_sd.htmpl condition

    Posted Sep 21, 2016 01:58 AM

    Hi Diego,

     

    You can use group membership as condition, the code you provided has the fellowing error:

    You does not include something in the PDM_LIST, this is the reason of "syntax error, unexpected FROM at FROM". For example, in SQL query you need to use "select * from chg". The asterisk represents what fields this query should return. To do this with PDM_LIST, at least one "$list.field_name" must be inside the PDM_LIST.

    For example:

    var test;
    <PDM_LIST PREFIX=list FACTORY=grpmem WHERE="member=U'$cst.id' AND group=U'<<GROUP UUID>>'">
         if ("$cst.id" == "$list.id") test = 1;
    </PDM_LIST>

    Your code is the SQL equivalent of "select from chg".

     

    Conan



  • 5.  Re: PDM_LIST menubar_sd.htmpl condition

    Posted Sep 23, 2016 10:19 AM

    Hi ConanLam!!!!!

     

    Many many thanx for your help!!

     

    Im trying to use the code that you suggested but i think im doing something wrong...

     

    var test;
    <PDM_LIST PREFIX=list FACTORY=grpmem WHERE="member=U'$cst.id' AND group=U'<<3DCF0D2E182FF746A9F938164A379865>>'">
         if ("$cst.id" == "$list.id") test = 1;
    </PDM_LIST>
    if (test != 1){
    <PDM_MACRO name=menuItem label="New_Change_Order..." function="ahdtop.create_new('chg',0)" hotkey="h">
    <PDM_MACRO name=menuItem label="New_Change_Order_from_Template" function="ahdtop.create_new('chg',1)" hotkey="w">
    }

     

    Can you tell me what I'm doing wrong ?!

     

    I'm trying to show the menu Change the order only to members who are not in the group id "3DCF0D2E182FF746A9F938164A379865".

     

    Many thanx again, ConanLam!!!



  • 6.  Re: PDM_LIST menubar_sd.htmpl condition
    Best Answer

    Posted Sep 23, 2016 11:08 AM
    <PDM_SET args.InGroup="No">
    <PDM_LIST PREFIX=list FACTORY=grpmem WHERE="member=U'$cst.id' AND group=U'3DCF0D2E182FF746A9F938164A379865'">
        // $list.id
        <PDM_SET
    args.InGroup="Yes">
    </PDM_LIST>
    <PDM_IF "$args.InGroup" == "No">
    <PDM_MACRO name=menuItem label="New_Change_Order..." function="ahdtop.create_new('chg',0)" hotkey="h">
    <PDM_MACRO name=menuItem label="New_Change_Order_from_Template" function="ahdtop.create_new('chg',1)" hotkey="w">
    </PDM_IF>

    I offer this up for your testing.



  • 7.  Re: PDM_LIST menubar_sd.htmpl condition

    Posted Sep 23, 2016 11:22 AM

    Excellent Lindsay_Estabrooks!!!!

     

    Working perfectly now.

     

    Thanx you and ConanLam too!