Clarity Service Management

Expand all | Collapse all

Extend the chg table

  • 1.  Extend the chg table

    Posted 01-18-2017 09:15 AM

    Hi Community ,

     

    Service Desk 12.9

    the customer wants to capture the 25 questions and answers as per customer change management so I've decided to create a custom tab in detail_chg.htmpl page.
    Secondly, to capture the custom values in schema I've found two types of solutions

    1. To create a 25 custom site defined attributes in Chg object but We'have already had a huge number of custom attributes in Chg object.

    2. Create a custom table, create the 25 custom columns in this table and relate the table to chg object.

     

    Can anyone have insights on the implementation of the creating a custom table and relating that to chg object?

    Thank you



  • 2.  Re: Extend the chg table

    Posted 01-18-2017 10:27 AM

    Venkat - why not use properties to accomplish this?  Or is it that they want the same questions on every change order, and not specific to any category??

    If thats the case, I would say it would be best to create a field for each question.  That would be much simpler than creating a whole new table and having to reference it outside. This would really only be needed if they were going to use dropdowns or selectable type fields.

    Thanks,

    Jon I.



  • 3.  Re: Extend the chg table

    Posted 01-18-2017 10:53 AM

    If the answers are "Yes" and "No" only, then the custom field can be "INTEGER" and you can use dtlCheckbox to map the Yes to 1 and No to 0.

    In this case a custom table and dropdown are not necessary.



  • 4.  Re: Extend the chg table

    Posted 01-18-2017 10:36 AM

    Hi,

    check this one: How to create associated table 

    Regards,

    cdtj



  • 5.  Re: Extend the chg table

    Posted 01-18-2017 10:37 AM

    Hi Jon,

     

    These questions are for all the Change Orders of particular tenant, we have a maximum of shared categories and very few tenant restricted categories.

    further, we have already a huge number of custom columns in chg table , so inclined to have a different table for this.

     

    Thank you



  • 6.  Re: Extend the chg table

    Posted 01-19-2017 11:49 AM

    Hi cdtj ,

     

    I have tried to extend the chg table and the below are steps that i have followed but some where i'm not doing correct. please advise.

     

    1. Created a custom table 

     

    Custom Table : zChgPrpBOSG
    ------------------------------
    OBJECT zChgPrpBOSG {
    ATTRIBUTES zChgPrpBOSG {
    Chgid SREL chg;
    prp1 STRING 400;
    prp2 STRING 400;
    last_mod_dt DATE { ON_CI SET NOW; };
    last_mod_by SREL cnt { ON_CI SET USER;
    ON_NEW DEFAULT USER; };
    };
    FACTORY zChgPrpBOSG {
    STANDARD_LISTS {
    MLIST OFF;
    RLIST OFF;
    };
    REL_ATTR id;
    };
    };

     

    2. Created a .maj and .spl file as follows

     

    .maj file is created and placed in site/mods/majic folder
    ------------------------------------------------------------
    OBJECT chg {
    ATTRIBUTES Change_Request {
    zBosgPrp BREL zChgPrpBOSG chg DYNAMIC {UI_INFO "dtlTextbox";};
    };
    TRIGGERS {
    POST_VALIDATE z_BOSG_Prp() 1201 FILTER( EVENT("INSERT UPDATE"));
    };
    };

    .spl file is created and placed in site/mods/majic folder
    ----------------------------------------------------------
    chg::z_BOSG_Prp(...) {
    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)"", "zChgPrpBOSG", NULL, 0,
    "chg",id );
    }

     

    zBosgPrp is a BREL attribute and zChgPrpBOSG is a a custom table.

     

    3. Htmpl tab form

     

    tab htmpl file
    -------------------------------
    <PDM_MACRO name=dtlStartRow>
    <PDM_MACRO name=dtlTextbox hdr="Properties 1" attr="zBosgPrp.prp1">
    <PDM_MACRO name=dtlTextbox hdr="Properties 1" attr="zBosgPrp.prp2">
    <PDM_MACRO NAME=dtlEndTable>

     

    Thank you,



  • 7.  Re: Extend the chg table

    Posted 01-19-2017 12:13 PM

    Hi,

    you have misspelled chg attriubte name:

    zBosgPrp BREL zChgPrpBOSG Chgid DYNAMIC {UI_INFO "dtlTextbox";}; 

    and

    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)"", "zChgPrpBOSG", NULL, 0,
    "Chgid",id );

    Regards, cdtj



  • 8.  Re: Extend the chg table

    Posted 01-19-2017 12:58 PM

    Hi cdtj,

     

    Thank you,  I have found below error log entries in logs,

     

    I think i have to map the tenant table to this custom table as well.

     

    01/19 11:51:00.70 ITSM-D-SD-A-1 spelsrvr 8252 SIGNIFICANT zChgPrpBOSG.spl 2 ### Entering to the Method:z_BOSG_Prp
    01/19 11:51:00.70 ITSM-D-SD-A-1 domsrvr 15772 ERROR srel_attr.c 3343 Attribute Chgid in untenanted object zChgPrpBOSG:400102 (zChgPrpBOSG:400102) cannot reference tenanted object chg:567852 (173395) with tenant IS - Shared services
    01/19 11:51:00.70 ITSM-D-SD-A-1 spelsrvr 8252 ERROR api.spl 1211 Error setting attr 'Chgid' on object 'zChgPrpBOSG:400102' to value '567852'


  • 9.  Re: Extend the chg table

    Posted 01-19-2017 03:38 PM

    Hi cdtj,

     

    I have made the custom table as  tenant table and the errors in logs were disappeared. However, when I'm creating a new change order a record in custom table getting created but prp1 and prp2 column values not getting updated with the form values.

     

    In  the image we can observe that prp1 and prp2 values are NULL.

     

    any advise on how to make this work?

     

     

    Form Code

     

     

    Thank you



  • 10.  Re: Extend the chg table

    Posted 01-20-2017 04:19 AM

    Hi,

    You are only inserting  the chgid in your send_wait() I think you will need to add your attributes there too for them to be recorded.

     

    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)"", "zChgPrpBOSG", NULL, 0,
    "Chgid",id,"prp1",prp1,"prp2",prp2 );

     

    /J



  • 11.  Re: Extend the chg table

    Posted 01-20-2017 07:10 AM

    Hi jmayer

    the clue of this customization in that you can modify associated table from current record like it presented in CI.

    For example CI with type Enterprise Service have entservx extension table, which could be modified using assoc_entservx.<entservx_attr_name> attribute.

     

    CodeGeek, I have recreated same scheme in my test environment and it didn't work... I can read attibutes through extension link but unable to update records. For most of undocumented functionallity "trial and error" is the only way to make it work. I'll perform additional tests but can't guarantee that will find a solution...

     

    Regards,

    cdtj



  • 12.  Re: Extend the chg table

    Posted 01-20-2017 07:22 AM

    Thank you ,

     

    I have modified the .spl file as advisedby jmayer It seems the prp1 attribute is unknown to the chg object

    below are the log entries in 

     

    01/20 06:10:39.47 ITSM-D-SD-A-1 spelsrvr 9140 ERROR pcexec.c 6365 Spell interp failed at zChgPrpBOSG.spl:3:chg::z_BOSG_Prp: get_attr on prp1 failed: AHD03066:Unknown name prp1
    01/20 06:10:39.47 ITSM-D-SD-A-1 web:local 8924 ERROR freeaccess.spl 24823 update checkin of chg:567953 failed: AHD03066:Unknown name

     

    venkat



  • 13.  Re: Extend the chg table

    Posted 01-20-2017 07:54 AM

    hi cdtj,

    i I understand you, that will mean in fact a new factory that will merge the 2 tables

     

    CodeGeek,

    the error make sense  as the prp1 is only defined on your new object

    a way to investigate will be to pass those values trought your triggers from one object to the othe

     

    TRIGGERS {
    POST_VALIDATE z_BOSG_Prp(prp1,prp2) 1201 FILTER( EVENT("INSERT UPDATE"));

    and use in your spl to set

     

    /J



  • 14.  Re: Extend the chg table

    Posted 01-20-2017 10:21 AM

    Hi jmayer , cdtj

     

    I have tried few things here, please find  the logs related to it.

     

    Some how, the form values of prp1 , prp2 are not passing to spl function 

     

    Trigger

     

    POST_VALIDATE z_BOSG_Prp(zBosgPrp,prp1,prp2) 1201 FILTER( EVENT("INSERT UPDATE"));

     

    Logs

     

    01/20 08:57:20.82 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 3 ### argv[0]= 3
    01/20 08:57:20.82 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 4 ### argv[1]= zBosgPrp
    01/20 08:57:20.83 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 5 ### argv[2]=
    01/20 08:57:20.84 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 6 ### argv[3]=
    01/20 08:57:20.85 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 7 ### argv[4]= prp1
    01/20 08:57:20.86 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 8 ### argv[5]=
    01/20 08:57:20.87 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 9 ### argv[6]=
    01/20 08:57:20.87 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 10 ### argv[7]= prp2
    01/20 08:57:20.88 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 11 ### argv[8]=
    01/20 08:57:20.89 ITSM-D-SD-A-1 spelsrvr 13180 SIGNIFICANT zChgPrpBOSG.spl 12 ### argv[9]=

    01/20 08:57:20.90 ITSM-D-SD-A-1 spelsrvr 13180 ERROR pcexec.c 6365 Spell interp failed at zChgPrpBOSG.spl:14:chg::z_BOSG_Prp: get_attr on prp1 failed: AHD03066:Unknown name prp1
    01/20 08:57:20.91 ITSM-D-SD-A-1 web:local 11976 ERROR freeaccess.spl 24823 update checkin of chg:567954 failed: AHD03066:Unknown name

     

    Thank you

     



  • 15.  Re: Extend the chg table

    Posted 01-25-2017 01:58 PM

    Hello,


    Can we take the cnt object example, tries to breakdown the logic on how ca_contact and usp_contact have relates to same object.


    The solution that i'm trying to achieve is similar to cnt object logic.


    One chg record in chg table should have one related column in custom table .


    Thank you




  • 16.  Re: Extend the chg table

    Posted 01-25-2017 02:11 PM

    In your maj file,

    OBJECT chg {
    ATTRIBUTES Change_Request {
    zBosgPrp BREL zChgPrpBOSG chg DYNAMIC {UI_INFO "dtlTextbox";};
    };

     

    zBosgPrp is your new attribute in "chg" object. It's a brel on your other objet zChgPrpBOSG. It uses the attribute containing your "chg" id, wich is Chgid, not chg.

     

    So if i understand how this MAJ stuff works correctly, the correct maj should be :

     

    OBJECT chg {
    ATTRIBUTES Change_Request {
    zBosgPrp BREL zChgPrpBOSG Chgid DYNAMIC {UI_INFO "dtlTextbox";};
    };

     

    Maybe the error saying that prp1 is unknown pops up because the brel zBosgPrp point to nowhere.

     

    I'm not that familiar with this type of customization, feel free to correct me if i got this wrong.