access lookup item description column

By using 'this.get("xxx").value' and 'this.get("xxx").displayValue' in the page edit code, it is possible to get the id and Name of a lookup item. Is there a way to access the value of the Description column too ?

Like 0

Like

2 comments

The only way I can think of to get the description is to first get the lookup item Id, then use an EntitySchemaQuery to get the description from the lookup object.

Something like this:

// get account type. then use an esq to get the 
// description for the selected type
 
var accountType = this.get("Type");
 
var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "AccountType"
});
esq.addColumn("Description");
esq.getEntity(accountType.value, function (result) {
    if (result.success) {
        var desc = result.entity.values.Description;
        console.log("Description is: " + desc);
  }
}, this);

I have an article on the basics of using EntitySchemaQuery, if needed, here: https://customerfx.com/article/an-introduction-to-performing-client-side-queries-using-entityschemaquery-in-creatio-formerly-bpmonline/

Ryan

It's possible to add the "Description" column of a lookup object by setting columns property of "lookupListConfig". There is an example for "Type" lookup below:

     attributes: {

            "Type": {

                lookupListConfig: {

                    columns: ["Description"]

                }

            }

        }

After that you can get "Description" column value by using  this.get("Type").Description

Show all comments