Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Function isRelation

    • Check if a property is a relation type that links to another LimeType.

      Relation types are: hasone, hasmany, belongsto, and hasandbelongstomany. These properties establish relationships between different object types in the CRM.

      Use this helper to determine if a property value will be a LimeObject or array of LimeObjects rather than a simple value.

      Parameters

      Returns boolean

      true if the property is a relation type, false otherwise

      import { PlatformServiceName, isRelation } from '@limetech/lime-web-components';

      const repository = platform.get(PlatformServiceName.LimeTypeRepository);
      const limetype = repository.getLimeType('deal');

      const relationProps = Object.values(limetype?.properties ?? {}).filter(
      isRelation
      );

      for (const property of relationProps) {
      const relatedType = property.relation?.getLimetype();
      console.log('Links to:', relatedType?.name);
      }