Menu

Editing Incident View

2011-06-16
2012-12-19
  • Rebecca Botvinik

    I am attempting to add the attribute "severity" to the incident view.  I have added it to the incident module configuration file, and run it through the customization toolkit, which returned a number of SQL statements required to add it to various views.  When I executed the statements, the database model and schema were fine, but I still cannot find my new field in any of the user screens in the application.

    I know that incident is really a child class to the ticket, but I am having trouble seeing the results of my edits…..

     
  • Denis

    Denis - 2011-06-16

    Hi,

    The details of an object (and the form to edit it) is driven by the 'ZList' definition.

    Check in the class definition for the line:

    MetaModel::Init_SetZListItems('details', array(....));
    
     
  • Rebecca Botvinik

    Thank you that was perfect advice, I now can see my ENUM field, however when I open a new incident it is already populated with the default value and there is no drop-down box.  I have reviewed the configs for other fields that do have a drop-down and I cannot find the difference.  I added the field as a varchar(20) but am not sure how to make the dropdown appear.

     
  • Denis

    Denis - 2011-06-17

    The way the field is displayed in edition depends the possible values for the field, as listed in its definition in iTop.
    If you declare the field as an enum

    MetaModel::Init_AddAttribute(new AttributeEnum("field_name", array("allowed_values"=>new ValueSetEnum('value1,value2,...'), ...
    

    Then the field will appear as a drop-down list in the object's form and the toolkit will propose to create the field as an ENUM in SQL.

    Did you put the part that defines the allowed values ?
    Can you post the part of the data model.php where your new field is defined ?

    Hope this helps

     
  • Rebecca Botvinik

    Hi dflaven, I figured it out, the piece I was missing to make the field a drop-down list was in the model for the ticket module.
    // Lifecycle
    MetaModel::Init_DefineState(
    "new",
    array(
    "attribute_inherit" => null,
    "attribute_list" => array( 'urgency' => OPT_ATT_MUSTCHANGE,
    'priority' => OPT_ATT_READONLY,
    'severity' => OPT_ATT_MUSTCHANGE,
             ),

    Changing severity from READ ONLY to MUST CHANGE did the trick!  I love this stuff.  Thank you for your help….

     
  • Denis

    Denis - 2011-06-17

    Ok, great. The meaning of such flags in the life cycle of the object is:

    READONLY => Ok, you got it, the field cannot be edited by the end user
    MUSTCHANGE => When the ticket enters the specified state, the end-user is prompted to change the value of this field
    MUSTPROMPT => When the ticket enters the specified state, the end-user is prompted to check the value… but not forced to change it

    If you declare nothing about a field in the life cycle, the field is *just* editable as any other field of the ticket.'

    Best regards

     
  • Marco Mak

    Marco Mak - 2011-11-16

    How can I add a field which only display information in Incident view? The value of this field will be get from database for display purpose.

    Thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.