In a previous post I talked about how to use the ClientEntityContext service to retrieve the current entity Id in client side javascript. I wanted to expand upon that to detail the other options available to be retrieved by that service.
The properties that are accessible are:
- EnitityId= the current record’s Id.
- Description=the defined String Expression for the Entity
- EntityType = The Sage.Entity.Interfaces implementation name of the Entity.
- EntityTableName = The underlying SQL table name the entity is bound to.
And here is a sample of accessing these in code. This sample is assuming being on a ticket.
var contextSvc = Sage.Services.getService(‘ClientEntityContext’);
var context = contextSvc.getContext();
var strEntityId = context.EntityId; //Returns the Current Ticket Id
var strEntityDesc = context.Description; //Returns the Entity’s String Expression, i.e. Ticket Number
var strEntityType = context.EntityType; //returns “Sage.Entity.Interfaces.ITicket”
var strEntityTable = context.EntityTableName; //returns “TICKET”



