This documentation supports the 9.1 to 9.1 Service Pack 3 version and its patches of BMC Atrium Core. The documentation for version 9.1.04 and its patches is available here.

To view the latest version, select the version from the Product version menu.

CMDBCreateAttribute function

The CMDBCreateAttribute function creates a new attribute with the specified name for the specified class.

Synopsis


#include "ar.h"
#include "arextern.h"
#include "cmdb.h"

int CMDBCreateAttribute(
      ARControlStruct *control,
      CMDBClassNameId classNameID,
      ARNameType attributeName,
      ARNameType attributeId,
      unsigned int dataType,
      ARInternalId *arsubclassesId,
      unsigned int entryMode,
      CMDBAttributeLimit *attributeLimit,
      ARValueStruct *defaultValue,
      ARPropList *characList,
      ARPropList *customCharacList,
      ARStatusList *status)

Input arguments

Input argument

Description

control

The control record for the operation, which contains information about the user requesting the operation and the server on which the operation is to be performed.

classNameId

The name of the class for which you want to create an attribute. The classNameID argument contains the namespace name and the unique class name.

attributeName

The name of the attribute to create. The name of the attribute must be unique within the specified class and within its superclasses and subclasses.

attributeId

The ID of the attribute to create.

dataType

The data type of the new attribute. Data types not listed are either unsupported or display fields.

  • 1: Keyword (CMDB_ATTR_DATA_TYPE_KEYWORD)
  • 2: Integer (CMDB_ATTR_DATA_TYPE_INTEGER)
  • 3: Real (CMDB_ATTR_DATA_TYPE_REAL)
  • 4: Character (CMDB_ATTR_DATA_TYPE_CHAR)
  • 5: Diary (CMDB_ATTR_DATA_TYPE_DIARY)
  • 6: Selection (CMDB_ATTR_DATA_TYPE_ENUM)
  • 7: Time (CMDB_ATTR_DATA_TYPE_TIME)
  • 10: Fixed-point decimal (CMDB_ATTR_DATA_TYPE_DECIMAL)
  • 11: Attachment (CMDB_ATTR_DATA_TYPE_ATTACH)
  • 12: Currency (CMDB_ATTR_DATA_TYPE_CURRENCY)
  • 13: Date (CMDB_ATTR_DATA_TYPE_DATE)
  • 14: Time of day (CMDB_ATTR_DATA_TYPE_TIME_OF_DAY)
  • 37: Attachment pool (CMDB_ATTR_DATA_TYPE_ATTACH_POOL)

arsubclassesId

The BMC Remedy AR System subclass ID of the new attribute. The IDs of all attributes must be unique within the class. If you want the system to generate the ID, specify 0 for this parameter.

entryMode

The entry mode for the attribute. Entry modes not listed are for BMC Software internal use.

  • 1: Required--Users must enter data (CMDB_ATTR_ENTRYMODE_REQUIRED ).
  • 2: Optional--Users do not have to enter data, but they can if needed (CMDB_ATTR_ENTRYMODE_OPTIONAL ).
  • 4: Display only--Users cannot enter data (CMDB_ATTR_ENTRYMODE_DISPLAY_ONLY ).

attributeLimit

The value limits for the attribute and other properties specific to the attribute's type. See the CMDBsubclassesLimitStruct definition in cmdb.h to find the contained structure that applies to the type of attribute that you are creating. The limits and properties that you assign must be of the same data type as the attribute. If you do not want to change the attribute limits and properties, specify NULL for this parameter.

defaultValue

The value to apply if a user submits an entry with no value for the new attribute. The default value can be up to 255 bytes and must be of the same data type as the attribute. If you do not want to specify a default value, specify NULL.

characList

A list of characteristics for the attribute. Characteristics not listed are not applicable for creating attributes.

  • 1: View Permissions--Specify a list of groups or roles that have permissions to view this attribute (CMDB_ATTR_CHARAC_VIEW_PERMS ). When querying for attributes, you see all attributes, including the hidden attributes. You can specify one or more group IDs or role IDs for the permissions, separated by a semicolon, for example, 20;-5.
  • 2: Change Permissions--Specify a list of groups or roles that have permissions to view and modify the characteristics of the attribute (CMDB_ATTR_CHARAC_CHANGE_PERMS ).
  • 3: Hidden--Set the flag to false so that this attribute is hidden (CMDB_ATTR_CHARAC_HIDDEN ). This setting marks the attribute as hidden for a group or a role. When querying for classes, you can retrieve hidden attributes. You can specify one or more group IDs or role IDs for the permissions, separated by a semicolon, for example, 20;3.
  • 5: Propagated Owner--The class ID and the attribute ID of the lead class attribute from which the attribute is propagated (CMDB_ATTR_CHARAC_PROPAGATED_OWNER ).
    The format for this value is:
    <sourceAttributeId>;<destinationAttributeId>|<sourceAttributeId>;<destinationAttributeId>|[<additionalPairs>].
  • 6: Create Mode--Set permissions for specifying data for the attribute (CMDB_ATTR_CHARAC_CREATE_MODE ).
    • 0 --CMDB_ATTR_CREATE_MODE_NONE --No permissions specified for the attribute.
    • 1 --CMDB_ATTR_CREATE_MODE_OPEN --Anyone can specify a value for the attribute.
    • 2 --CMDB_ATTR_CREATE_MODE_PROTECTED --Only users with permissions can specify a value for the attribute.
  • 7: Audit Option--Set the audit option on to store the audit history for the attribute (CMDB_ATTR_CHARAC_AUDIT_OPTION ).
  • 8: Namespace--Set the namespace of the attribute (CMDB_ATTR_CHARAC_NAMESPACE ).
  • 9: Description--Set the description for the attribute
    (CMDB_ATTR_CHARAC_DESCRIPTION ).
  • 10: Federation External Name--Specify external name for attributes of a federated class that are mapped by way of Vendor AR System database connectivity (ARDBC) plug-in (CMDB_ATTR_CHARAC_FEDERATION_EXTERNAL_NAME ).

customCharacList

A list of user-defined custom characteristics for the attribute. The attributes must be between 300000 (CMDB_ATTR_CUSTOM_CHARAC_MIN ) and 399999 (CMDB_ATTR_CUSTOM_CHARAC_MAX ). After the properties list structure that you specify is serialized, it is converted into the following format:
<listSize> <propId> <dataType> <propValue>

  • listSize: The number of items in the properties list.
  • propId: The ID for the property, which is within the 300000-399999 range.
  • dataType: The native data type for the property.
  • propValue: The value for the property. An example for the serialized property list is 1\300050\2\1.

Return value

Return value

Description

status

A list of zero or more notes, warnings, or errors generated from a call of this function.

Was this page helpful? Yes No Submitting... Thank you

Comments