import {
PlatformServiceName,
isDate,
isRelation,
isSingleRelation,
isString,
} from '@limetech/lime-web-components';
const repository = platform.get(PlatformServiceName.LimeTypeRepository);
const property = repository.getLimeType('deal')?.getProperty('company');
if (property && isRelation(property)) {
console.log('This property links to another type');
const relatedType = property.relation?.getLimetype();
if (isSingleRelation(property)) {
console.log('This is a single-object relation (belongsto or hasone)');
} else {
console.log('This is a multi-object relation (hasmany or habtm)');
}
}
if (property && isDate(property)) {
console.log('This property stores date/time information');
}
if (property && isString(property)) {
console.log('This property stores text');
console.log('Max length:', property.length);
}
import type {
LimeObjectValue,
LimeProperty,
} from '@limetech/lime-web-components';
function formatPropertyValue(
property: LimeProperty,
value: LimeObjectValue
): string {
switch (property.type) {
case 'string':
case 'text':
case 'phone':
case 'link': {
return String(value);
}
case 'integer':
case 'decimal': {
return Number(value).toLocaleString();
}
case 'percent': {
return `${(Number(value) * 100).toFixed(2)}%`;
}
case 'yesno': {
return value ? 'Yes' : 'No';
}
case 'option': {
const option = property.options?.find((opt) => opt.key === value);
return option?.text ?? '';
}
case 'time':
case 'date': {
return new Date(String(value)).toLocaleString();
}
default: {
return JSON.stringify(value);
}
}
}
All available property types in the Lime CRM system.
Property types determine how data is stored, validated, and displayed. They fall into several categories:
Simple Values:
string- Short text (up to 255 characters typically)text- Long text (unlimited length)phone- Phone numberlink- URL/hyperlinkinteger- Whole numberdecimal- Decimal number with fractional partpercent- Percentage value (stored as decimal)yesno- Boolean value (true/false)Selection Types:
option- Single selection from predefined list (dropdown)set- Multiple selections from predefined list (multi-select)user- Reference to a Lime userRelation Types (link to other LimeTypes):
belongsto- Many-to-one relationship (e.g., deal belongs to one company)hasone- One-to-one relationship (e.g., person has one main address)hasmany- One-to-many relationship (e.g., company has many deals)hasandbelongstomany- Many-to-many relationship (e.g., deal has many participants)Other Types:
file- File attachmentxml- XML datasystem- System-managed property (usually read-only)Date/Time Types: See DateTimePropertyType