Class ObjectTypeDefinition

The class provides access to the meta data of a system object or custom object. A short example should suffice to demonstrate how this metadata can be used in a script:

1var co : CustomObject = CustomObjectMgr.getCustomObject("sample", "MyCustomObject");
2
3// get the object type definition
4var typeDef : ObjectTypeDefinition = co.describe();
5// get the custom object attribute definition for name "enumIntValue"
6var attrDef : ObjectAttributeDefinition = typeDef.getCustomAttributeDefinition( "enumIntValue" );
7// get the collection of object attribute value definitions
8var valueDefs : Collection = attrDef.getValues();
9
10// return function if there are no object attribute value definitions
11if(valueDefs.isEmpty())
12{
13    return;
14}
15
16var displayValue : String;
17// loop over object attribute value definitions collection
18for each ( var valueDef : ObjectAttributeValueDefinition in valueDefs )
19{
20    if( valueDef.getValue() == co.custom.intValue )
21    {
22        displayValue = valueDef.getDisplayValue();
23        break;
24    }
25}

Property Summary 

PropertyDescription
ID: String (read-only)Returns the type id of the business objects.
attributeDefinitions: Collection (read-only)Returns a collection of all declared attributes for the object.
attributeGroups: Collection (read-only)Returns a collection of all declared attribute groups.
displayName: String (read-only)Returns the display name of the definition, which can be used in the user interface.
system: Boolean (read-only)Identifies if this object definition is for a system type or a custom type.

Constructor Summary 

This class does not have a constructor, so you cannot create it directly.

Method Summary 

MethodDescription
getAttributeDefinitions()Returns a collection of all declared attributes for the object.
getAttributeGroup(String)Returns the attribute group with the given name within this object type definition.
getAttributeGroups()Returns a collection of all declared attribute groups.
getCustomAttributeDefinition(String)Returns the custom attribute definition with the given name.
getDisplayName()Returns the display name of the definition, which can be used in the user interface.
getID()Returns the type id of the business objects.
getSystemAttributeDefinition(String)Returns the system attribute definition with the given name.
isSystem()Identifies if this object definition is for a system type or a custom type.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Property Details 

ID 

ID: String (read-only)

Returns the type id of the business objects.


attributeDefinitions 

attributeDefinitions: Collection (read-only)

Returns a collection of all declared attributes for the object. The collection contains both system and custom attributes. There might be system and custom attribute with identical names. So the name of the attribute is not a uniqueness criteria. Additional the isCustom() flag must be checked.


attributeGroups 

attributeGroups: Collection (read-only)

Returns a collection of all declared attribute groups. A attribute group is a collection of attribute, which are typically displayed together as a visual group.


displayName 

displayName: String (read-only)

Returns the display name of the definition, which can be used in the user interface.


system 

system: Boolean (read-only)

Identifies if this object definition is for a system type or a custom type.


Method Details 

getAttributeDefinitions() 

getAttributeDefinitions(): Collection

Returns a collection of all declared attributes for the object. The collection contains both system and custom attributes. There might be system and custom attribute with identical names. So the name of the attribute is not a uniqueness criteria. Additional the isCustom() flag must be checked.

Returns:

  • a collection of all declared attributes for the object.

getAttributeGroup(String) 

getAttributeGroup(name: String): ObjectAttributeGroup

Returns the attribute group with the given name within this object type definition.

Parameters:

  • name - The name of the attribute scope to return.

Returns:

  • The matching attribute scope or null if no such scope exists.

getAttributeGroups() 

getAttributeGroups(): Collection

Returns a collection of all declared attribute groups. A attribute group is a collection of attribute, which are typically displayed together as a visual group.

Returns:

  • a collection of all declared attribute groups.

getCustomAttributeDefinition(String) 

getCustomAttributeDefinition(name: String): ObjectAttributeDefinition

Returns the custom attribute definition with the given name. The method returns null if no custom attribute is defined with that name.

Parameters:

  • name - The unique name of the custom attribute definition within the object type.

Returns:

  • The matching attribute definition or null in case no such definition exists.

getDisplayName() 

getDisplayName(): String

Returns the display name of the definition, which can be used in the user interface.

Returns:

  • the display name of the definition, which can be used in the user interface.

getID() 

getID(): String

Returns the type id of the business objects.

Returns:

  • the type id of the business objects.

getSystemAttributeDefinition(String) 

getSystemAttributeDefinition(name: String): ObjectAttributeDefinition

Returns the system attribute definition with the given name. The method returns null if no system attribute is defined with that name. Only system objects have system attributes. A CustomObject has no system attributes and so the method will always return null for a CustomObject.

Parameters:

  • name - The unique name of the custom attribute definition within the object type.

Returns:

  • The matching attribute definition or null in case no such definition exists.

isSystem() 

isSystem(): Boolean

Identifies if this object definition is for a system type or a custom type.

Returns:

  • true if this object definition is for a system type, false otherwise.

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!