Package: entity

Examples

Create a new entity

//Create the customization set variable to hold the required changes
var cs = entity->createCustomizationSet();

//Create a new entity
entity->createEntity(cs, "product");
entity->createEntity(cs, "category");

//Create some properties
entity->createProperty(cs, "product", "name", "string", true, "");
entity->createProperty(cs, "product", "description", "string31", false, "");
entity->createProperty(cs, "product", "price", "decimal", false, "0");

//Create a relationship
entity->createRelationship(cs, "product_category", "n:1", "product", "category", null, null, false)

//Publish the customization set
entity->publish(cs);

Methods

alterEntity

method alterEntity(cs as customizationset,
  entityName as string, isACLEnabled as bool)

Alters an entity by enabling or disabling ACL.

changeOwnership

method changeOwnership(entityName as string, key as int,
  idUser as int, idBusinessUnit as int, idOrganization as int)

Changes the ownership of a record within an entity.

Since 1.7.0

createCustomizationSet

function createCustomizationSet() as customizationset

Creates a new customization set.

createEntity

method createEntity(cs as customizationset, entityName as string)

Creates an entity.

createEntityACL

method createEntityACL(cs as customizationset,
  entityName as string, isACLEnabled as bool)

Creates an entity with ACL enabled.

createProperty

method createProperty(cs as customizationset, entityName as string,
  propertyName as string, type as string, isRequired as bool,
  defaultValue as string)

Creates a property.

type can be one of the following:

  1. "#", "int" or "integer" for INTEGER data type.
  2. "%" or "decimal" for DECIMAL data type.
  3. "@" or "datetime" for DATETIME data type.
  4. "&" or "string" for STRING data type.
  5. "&31" or "string31" for STRING31 data type.

createRelationship

method createRelationship(cs as customizationset,
  relationshipName as string, relationshipTypeName as string,
  entityName as string, foreignEntityName as string,
  propertyName as string, foreignPropertyName as string, isRequired as bool)

Creates a relationship.

relationshipTypeName can be one of the following: OneToMany, OneToOne, ManyToMany, ManyToOne, ParentChild, ChildParent

createRelationshipEx

method createRelationshipEx(cs as customizationset,
  relationshipName as string, relationshipTypeName as string,
  entityName as string, foreignEntityName as string,
  propertyName as string, foreignPropertyName as string, isRequired as bool,
  sortPropertyName as string, sortAsc as bool)

Creates a relationship with sorting options.

publish

method publish(cs as customizationset)

The customization set is published.

unpublish

method unpublish(customizationSetName as string)

The customization set is unpublished.

Types

customizationset

PropertyTypeDescription
namestringThe name of the customization set