Attachments on Configuration Items r12

From SDU
Revision as of 14:36, 1 October 2013 by Mitcr01 (Talk | contribs) (The Attachment Tab form: - fix.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.


Overview

This article provides instructions for adding attachment capabilities to Configuration Items in CA Service Desk Manager.

Note: This customization is designed for r12.5 and above versions, providing an implementation of the previous Attachments on Configuration Items customization. The previous customization is targeted for r11.x and r12.0/r12.1 CA SDM version.


Procedures

SDM Schema customizations

Use the Web Screen Painter to add a new Table in the Schema Designer. The new table should be called zlrel_attachment_nrs and should have 2 fields:

Field name Type of Field
nr SREL to 'nr', required
attmnt SREL to 'attmnt', required

Set the Function Group of this new table to "Configuration Item". Save the Schema changes in the Schema Designer and then choose 'File->Save and Publish' from the menu.

In order for the Schema changes to be applied, stop the CA Service Desk Manager service on the primary server and then execute 'pdm_publish' from a command prompt.

Before starting the CA Service Desk Manager service, create a new MAJ file in the $NX_ROOT/site/mods/majic folder, called z_nr_cis.maj. This file should contain the following lines: <source lang=text> //////////////////////////////////////////////////////////////////////// // Factory: attmnt ////////////////////////////////////////////////////////////////////////

OBJECT attmnt {

 ATTRIBUTES Attachment {
   nrs BREL zlrel_attachment_nrs attmnt { LREL nr; } ;    
 };

};

//////////////////////////////////////////////////////////////////////// // Factory: nr ////////////////////////////////////////////////////////////////////////

OBJECT nr {

 ATTRIBUTES usp_owned_resource SECONDARY {
   attachments BREL zlrel_attachment_nrs nr { LREL attmnt; } ;
 };

}; </source> Make sure the file has the .maj extension, otherwise it will not be processed by SDM.

Finally, start the CA Service Desk Manager service back on and make sure that there are no errors reported in the stdlogs.

Interface customizations

Configuration Item detail form

Customize the cmdbNotebook.htmpl form to add a new Tab to the Configuration Item detail form. The form contains the definition of all the Tabs that appear on the Configuration Item detail form, you can just insert the new Tab definition where desired, using the following code:

<source lang="html4strict"> <PDM_MACRO NAME=TAB title="Files" ID=Attachments SRC="OP=SHOW_DETAIL+HTMPL=xx_attmnt_tab.htmpl+FACTORY=nr+PERSID=$args.persistent_id+NO_DP=yes"></source>

Attachments list form

Customize the list_attmnt_sd.htmpl form by adding lines in 2 places. First, after the line <source lang="Javascript">document.write('<input type="hidden" name="QBE.EQ.issues.iss.persistent_id" value="$args.QBE.EQ.issues.iss.persistent_id">');</source> the following code should be added <source lang="Javascript"> // Custom - enable the display of Attachments in a Tab on the Configuration Item detail form document.write('<input type="hidden" name="QBE.EQ.nrs.nr.id" value="$args.QBE.EQ.nr_list.nr.id">'); // END Custom </source>

Second, after the line <source lang="javascript"> case "chg": attmntAccess = "${ACCESS.FAC_chg:0}" - 0; break; </source> the following code should be added <source lang="javascript"> // Custom - enable the display of Attachments in a Tab on the Configuration Item detail form case "nr": attmntAccess = "${ACCESS.FAC_nr:0}" - 0; break; // END Custom </source>

The Attachment Tab form

Customize the xx_attmnt_tab.htmpl file.

1. Search for the following code fragment: <source lang="javascript"> var attmntAccess = 0; switch ("$prop.factory") {

  case "cr":  attmntAccess = "${ACCESS.FAC_cr:0}" - 0; break;
  case "iss": attmntAccess = "${ACCESS.FAC_iss:0}" - 0; break;
  case "chg": attmntAccess = "${ACCESS.FAC_chg:0}" - 0; break;

} </source> and replace it with <source lang="javascript"> var attmntAccess = 0; switch ("$prop.factory") {

  case "cr":  attmntAccess = "${ACCESS.FAC_cr:0}" - 0; break;
  case "iss": attmntAccess = "${ACCESS.FAC_iss:0}" - 0; break;
  case "chg": attmntAccess = "${ACCESS.FAC_chg:0}" - 0; break;
  // Custom - enable the Attachments tab on the Configuration Item detail form
  case "nr": attmntAccess = "${ACCESS.FAC_nr:0}" - 0; break;
 // End Custom

} </source>

2. Towards the end of the file, after <source lang="javascript"> <PDM_ELIF "$prop.factory" == "iss">

     att_tab_url += "+QBE.EQ.issues.iss.persistent_id=$args.persistent_id";

</source> add the following code: <source lang="javascript" > <PDM_ELIF "$prop.factory" == "nr">

     att_tab_url += "+QBE.EQ.nrs.nr.id=$args.id";

</source>

Clear the SDM web cache

Clear the SDM Webengine web cache by executing 'pdm_webcache' in a command prompt on the SD primary server. This will incorporate the interface customizations done in the previous steps and show them in the SDM web client.