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

    Interface LimeObject

    Represents a business object instance in Lime CRM.

    A LimeObject is an instance of a LimeType with actual data values. It contains the object's properties, metadata, and methods for accessing data including related objects. Use the getValue() method to access properties — it supports dot notation for navigating relations.

    Key characteristics:

    • Each object has a unique numeric ID
    • Contains audit timestamps (created, last updated)
    • Has a descriptive text representation
    • Use getValue() to access properties, with dot notation for relations
    • Can have attached files
    import { State } from '@stencil/core';
    import {
    LimeObject,
    SelectCurrentLimeObject,
    } from '@limetech/lime-web-components';

    class MyComponent {
    @State()
    @SelectCurrentLimeObject()
    private limeObject: LimeObject;

    private logObject() {
    console.log(this.limeObject.descriptive);
    console.log(this.limeObject.id);
    console.log(new Date(this.limeObject.createdtime).toLocaleDateString());
    console.log(this.limeObject.getValue('name'));
    }
    }
    import { State } from '@stencil/core';
    import {
    LimeObject,
    SelectCurrentLimeObject,
    } from '@limetech/lime-web-components';

    class MyComponent {
    @State()
    @SelectCurrentLimeObject()
    private deal: LimeObject;

    private readDealValues() {
    const dealName = this.deal.getValue('name');
    const dealValue = this.deal.getValue('value');

    // The path must have been loaded, otherwise the result is `undefined`.
    const companyName = this.deal.getValue('company.name');

    return { dealName, dealValue, companyName };
    }
    }

    Only loaded properties are readable. Nested objects and properties are not lazy loaded, so decide which paths to load up front. See getValue.

    The system fields id, createdtime, timestamp, and descriptive come from LimeObjectSystemProperties. Property values are typed as LimeObjectValue.

    interface LimeObject {
        createdtime: string;
        descriptive: string;
        id: number;
        timestamp: string;
        getFile(name: string): LimeFile | undefined;
        getLimetype(): LimeType;
        getValue(name: string): any;
        [property: string]: any;
    }

    Hierarchy (View Summary)

    Indexable

    • [property: string]: any

      Dynamic property access for object properties.

      Properties are accessible via bracket notation, but prefer getValue instead for consistent and relation-aware access.

    Index

    Properties

    createdtime: string

    ISO 8601 timestamp when this object was created.

    This is an audit field that records when the record was first created in the system. The timestamp includes date and time with timezone.

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

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const limeObject = repository.getObject('company', 1234);

    if (limeObject) {
    const created = new Date(limeObject.createdtime);
    console.log(`Created on: ${created.toLocaleDateString()}`);
    }
    descriptive: string

    Human-readable text representation of this object.

    This is the display name shown in lists, dropdowns, and references. Calculated from labels set on the LimeType's properties. Can be a single field or a combination of multiple fields.

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

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);

    const company = repository.getObject('company', 1234);
    const person = repository.getObject('person', 5678);

    console.log(company?.descriptive); // "Acme Corporation"
    console.log(person?.descriptive); // "John Doe" (firstname + lastname)
    id: number

    Unique identifier for this object.

    The ID is a positive integer that uniquely identifies this record within its LimeType. IDs are auto-generated and immutable.

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

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const limeObject = repository.getObject('company', 1234);

    if (limeObject) {
    console.log(`Object ID: ${limeObject.id}`); // "Object ID: 1234"
    }
    timestamp: string

    ISO 8601 timestamp of the last modification to this object.

    Updated automatically whenever any property of the object changes.

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

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const limeObject = repository.getObject('company', 1234);

    if (limeObject) {
    const updated = new Date(limeObject.timestamp);
    const minutesAgo = (Date.now() - updated.getTime()) / 60_000;
    console.log(`Last updated ${Math.floor(minutesAgo)} minutes ago`);
    }

    Methods

    • Get an attached file from a file property.

      Returns the LimeFile object for file attachments. Use this to access file metadata (name, size, MIME type) and download URLs.

      Parameters

      • name: string

        Name of the file property.

      Returns LimeFile | undefined

      The LimeFile if a file is attached, undefined otherwise.

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

      const repository = platform.get(PlatformServiceName.LimeObjectRepository);
      const limeObject = repository.getObject('deal', 1234);

      const document = limeObject?.getFile('contract_pdf');

      if (document) {
      console.log(`File: ${document.filename}`);
      console.log(`Size: ${document.size} bytes`);
      console.log(`Extension: ${document.extension}`);

      const downloadUrl = document.getUrl('download');
      }
    • Get the LimeType definition for this object.

      Returns the type definition containing schema information, property definitions, ACL rules, and other metadata about this object's type.

      Returns LimeType

      The LimeType definition.

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

      const repository = platform.get(PlatformServiceName.LimeObjectRepository);
      const limeObject = repository.getObject('deal', 1234);

      if (limeObject) {
      const limetype = limeObject.getLimetype();
      console.log(`Object type: ${limetype.name}`);
      console.log(`Display name: ${limetype.localname.singular}`);

      const canEdit = limetype.acl.update;

      const nameProperty = limetype.getProperty('name');
      console.log(`Name is required: ${nameProperty.required}`);
      }
    • Get the value of a property using dot notation to navigate relations.

      This method provides type-safe property access with support for navigating through related objects. Use dot notation to traverse relations, e.g., company.address.city to get the city of a company's address.

      This is the recommended way to access all properties, including simple values and relations.

      Only properties that were loaded are returned. There is no lazy loading today, so reading a property or a relation that was not loaded returns undefined instead of fetching it. Ask for the paths you need up front through LoadOptions.properties, using dot notation for values on related objects.

      Parameters

      • name: string

        Property name or path. Use dots to navigate relations.

      Returns any

      The property value, or undefined if the property was not loaded. For relations, returns the related LimeObject.

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

      const repository = platform.get(PlatformServiceName.LimeObjectRepository);
      const deal = repository.getObject('deal', 1234);

      const name = deal?.getValue('name');
      const status = deal?.getValue('status');
      const value = deal?.getValue('value');
      import { PlatformServiceName } from '@limetech/lime-web-components';

      const repository = platform.get(PlatformServiceName.LimeObjectRepository);

      const deal = await repository.loadObject('deal', 1234, {
      properties: ['name', 'company.name', 'contact.email'],
      });

      const companyName = deal?.getValue('company.name');
      const contactEmail = deal?.getValue('contact.email');

      // Not loaded above, so this is `undefined` rather than a fetch
      const contactPhone = deal?.getValue('contact.phone');

      LoadOptions.properties to choose which properties are loaded