# MTPriceableItem

This object is the base class for MTUsageCharge, MTRecurringCharge, MTNonRecurringCharge, MTDiscount. Can be a template (standalone, cannot be subscribed to) or an instance (added to a product offering).

To view an object model diagram that includes MTPriceableItem, click here. To view a diagram that includes this object in the context of rating, click here.

## Program ID

Metratech.MTPriceableItem.1

## Methods

CanBeModified | If this method returns true, a user can modify the priceable item (for example, remove it from the database).
Save | Saves modifications to this priceable item in the database.
GetParent | Returns the parent template/instance if this is a child of a compound priceable item, or NULL if no parent.
GetChildren | Returns any child templates/instances if this is a compound priceable item, or empty collection otherwise.
GetChildrenAsRowset | Same as GetChildren, but returns a rowset.
GetPriceListMapping | For a given instance, this method gets the Non-ICB price list mapping object given a parameter table ID. For templates, an error is returned. Note: An instance has exactly one Non-ICB price list mapping for each parameter table definition of its priceable item type.
GetPriceListMappingAsRowset | Returns a rowset of Non-ICB and ICB price list mappings.
GetNonICBPriceListMappingAsRowset | Returns a rowset of Non-ICB price list mappings.
CopyTo | Copies this instance or template to another instance or template.
GetTemplate | For a given instance, this method returns the template that the instance is based on. For templates, this method returns NULL.
IsTemplate | Returns true if this is a priceable item template, false if this is a priceable item instance
CheckConfiguration | Checks if this priceable item is completely configured. This method is called before making the product offering available. Returns collection of error strings if the priceable item is incorrectly configured. Returns empty collection if the priceable item is correctly configured.
GetInstances | For templates, this returns all instances of this template. For instances, an error is returned.
GetProductOffering | For instances, this method returns the product offering that this instance is contained in. For templates this method returns NULL.
SetPriceListMapping | Overrides the price list for a parameter table. For templates: Returns an error. For instances: specifies a price list for a given parameter table ID. Note: To modify other properties of a price list mapping object (CanICB, or rate schedules) use GetPriceListMapping and manipulate the returned object

## Properties

Properties | Returns all (core and extended) properties of this object as a collection of MTProperty objects.
ID | The unique (database) ID of the priceable item. This value is unique among all priceable items, including templates, instances, and kinds.
Kind | The category of the priceable item or discount. Can be one of the following: PCENTITY_TYPE_USAGE = 10, PCENTITY_TYPE_AGGREGATE_CHARGE = 15, PCENTITY_TYPE_RECURRING = 20, PCENTITY_TYPE_NON_RECURRING = 30, PCENTITY_TYPE_DISCOUNT = 40
Name | The unique name used internally in the MT platform.
DisplayName | The localizable name, shown to the user.
PriceableItemType | The priceable item type object that is the base for this template or instance.
Description | The description of the priceable item.

# Method Detail

## CanBeModified

If this method returns true, a user can modify the priceable item (for example, remove it from the database).

### Visual Basic Syntax

CanBeModified() As Boolean

### C++ Syntax

HRESULT CanBeModified([out, retval] VARIANT_BOOL *pVal);

## Save

This method saves modifications to this priceable item to the database.

### Visual Basic Syntax

Save()

### C++ Syntax

HRESULT Save();

## GetParent

This returns the parent template/instance if this is a child of a compound priceable item, or NULL if no parent.

### Visual Basic Syntax

GetParent() as MTPriceableItem

### C++ Syntax

HRESULT GetParent([out, retval] IMTPriceableItem** apParentPrcItem);

## GetChildren

This method returns any child templates/instances if this is a compound priceable item, or empty collection otherwise.

### Visual Basic Syntax

GetChildren() As MTCollection

### C++ Syntax

HRESULT GetChildren([out, retval] IMTCollection** apColl);

## GetChildrenAsRowset

This method operates the same as GetChildren, but returns a rowset.

### Visual Basic Syntax

GetChildrenAsRowset() As MTRowSet

### C++ Syntax

HRESULT GetChildrenAsRowset([out, retval] IMTRowSet** apRowset);

## GetChild

Returns any child templates/instances if this is a compound priceable item, or empty collection otherwise.

### Visual Basic Syntax

GetChild(ID As Long) As MTPriceableItem

### C++ Syntax

HRESULT GetChild([in]long aID, [out, retval]IMTPriceableItem** apPrcItem);

## GetPriceListMapping

For a given instance, this method gets the Non-ICB price list mapping object given a parameter table ID. For templates, an error is returned.

Note: An instance has exactly one Non-ICB price list mapping for each parameter table definition of its priceable item type.

### Visual Basic Syntax

GetPriceListMapping(ParamTblDefID As Long) As MTPriceListMapping

### C++ Syntax

HRESULT GetPriceListMapping([in] long aParamTblDefID, [out, retval] IMTPriceListMapping** apPrcLstMap);

## GetPriceListMappingAsRowset

Returns a rowset of Non-ICB and ICB price list mappings.

### Visual Basic Syntax

GetPriceListMappingsAsRowset() As MTRowSet

### C++ Syntax

HRESULT GetPriceListMappingsAsRowset([out, retval] IMTRowSet** apRowset);

## GetNonICBPriceListMappingAsRowset

This method returns a rowset of Non-ICB price list mappings.

### Visual Basic Syntax

GetNonICBPriceListMappingsAsRowset() As MTRowSet

### C++ Syntax

RESULT GetNonICBPriceListMappingsAsRowset([out, retval] IMTRowSet** apRowset);

## CopyTo

This method copies this instance or template to another instance or template.

### Visual Basic Syntax

CopyTo() As MTPriceableItem

### C++ Syntax

HRESULT CopyTo([in] IMTPriceableItem* apTarget);

## GetTemplate

For a given instance, this method returns the template that this instance is based on. For templates, the method returns NULL.

### Visual Basic Syntax

GetTemplate() As MTPriceableItem

### C++ Syntax

HRESULT GetTemplate([out, retval] IMTPriceableItem** apPrcItemTemplate);

## IsTemplate

This method returns true if this is a priceable item template, false if this is a priceable item instance

### Visual Basic Syntax

IsTemplate() As Boolean

### C++ Syntax

HRESULT IsTemplate([out, retval] VARIANT_BOOL* apIsTemplate);

## SetPriceListMapping

This method checks if this priceable item is completely configured. This method is called before making product offering available. Returns collection of error strings if incorrectly configured. Returns empty collection if correctly configured.

### Visual Basic Syntax

SetPriceListMapping(ParamTblDefID As Long, PrcLstID As Long)

### C++ Syntax

HRESULT SetPriceListMapping([in] long aParamTblDefID, [in] long aPrcLstID);

## GetInstances

For templates, this method returns all instances of this template. For instances, an error is returned.

### Visual Basic Syntax

GetInstances() As MTCollection

### C++ Syntax

HRESULT GetInstances([out, retval]IMTCollection** apInstances);

## GetProductOffering

For instances, this method returns the product offering that this instance is contained in. For templates this method returns NULL.

### Visual Basic Syntax

GetProductOffering() As MTProductOffering

### C++ Syntax

HRESULT GetProductOffering([out, retval] IMTProductOffering** apProdOff);

## CheckConfiguration

This method overrides the price list for a parameter table.

- For templates: Returns an error.

- For instances: specifies a price list for a given parameter table ID.

Note: To modify other properties of a price list mapping object (CanICB, or rate schedules) use GetPriceListMapping and manipulate the returned object

### Visual Basic Syntax

CheckConfiguration() As MTCollection

### C++ Syntax

HRESULT CheckConfiguration([out, retval] IMTCollection** apErrors);

# Properties Detail

## Properties

This property returns all (core and extended) properties of this object as a collection of MTProperty objects.

### Visual Basic Syntax

Property Properties As MTProperties

### C++ Syntax

HRESULT Properties([out, retval] IMTProperties** pVal);

## ID

This property specifies the unique identifier for the priceable item. This value is unique among all priceable items, including templates, instances, and kinds.

### Visual Basic Syntax

Property ID As Long

### C++ Syntax

HRESULT ID([out, retval] long *pVal);

HRESULT ID([in] long newVal);

## Kind

This property specifies the category of the priceable item or discount. Can be one of the following:

- UsageCharge

- RecurringCharge

- NonRecurringCharge

- Discount

### Visual Basic Syntax

Property Kind As MTPCEntityType

### C++ Syntax

HRESULT Kind([out, retval] MTPCEntityType *pVal);

HRESULT Kind([in] MTPCEntityType newVal);

## Name

This property specifies the unique name used internally in the MT platform.

### Visual Basic Syntax

Property Name As String

### C++ Syntax

HRESULT Name([out, retval] BSTR *pVal);

HRESULT Name([in] BSTR newVal);

## DisplayName

This property specifies the localizable name, shown to the end user.

### Visual Basic Syntax

Property DisplayName As String

### C++ Syntax

HRESULT DisplayName([out, retval] BSTR *pVal);

HRESULT DisplayName([in] BSTR newVal);

## PriceableItemType

This property specifies the priceable item type object that is the base for this template or instance.

### Visual Basic Syntax

Property PriceableItemType As MTPriceableItemType

### C++ Syntax

HRESULT PriceableItemType([out, retval] IMTPriceableItemType** pVal);

HRESULT PriceableItemType([in] IMTPriceableItemType* newVal);

## Description

Description of the priceable item (internal to the MT system).

### Visual Basic Syntax

Property Description As String

### C++ Syntax

HRESULT Description([out, retval] BSTR *pVal);

HRESULT Description([in] BSTR newVal);