Hi Team,



The onLookupDataLoaded: function(config) is not triggered for a custom lookup field in the object. However, the same is triggering for the OOTB lookup columns.



When the control is passed to the lookup, the onLookupDataLoaded event has to trigger but it isn't triggering for custom/newly created lookup in objects.



Are any additional changes required for new lookup columns added to the object?



BR,

Bhoobalna Palanivelu.

Like 0

Like

1 comments

Hi Bhoobalan,

 

This method was triggered for the custom lookup added to the page on my side. Are you sure the method is not triggered?

 

Best regards,

Oscar 

Show all comments

Hi Team,

 I have been using a lookup field and implementing a filter via LookupListConfig.



Here I have an issue in filtering the values.



Step 1: If the logged-in used belongs to the System Administrator role, the filter for the lookup is working fine and it shows the records.

 

Step 2: If the same user is removed from the System Administrator role, the filter is not working and it does not shows any records.

Here is the utilization of lookupListConfig

"UsrApplyName": {
		                "dataValueType": Terrasoft.DataValueType.LOOKUP,
		                "lookupListConfig": {
		                	columns: [ "Id" ],
		                    "filters": [
		                        function() {
		                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
									var CurContactAccount = Terrasoft.SysValue.CURRENT_USER_ACCOUNT.value;
		                          		filterGroup.add("IsActive",
		                                Terrasoft.createColumnFilterWithParameter(
		                                    Terrasoft.ComparisonType.EQUAL,
		                                    "UsrRecepientCompany",
		                                    CurContactAccount));
		                          		return filterGroup;
		                        }
		                    ]
		                }
					},

 

 

Kindly help me with the above hindrance and let me know what causes the difference and how to overcome it.





Regards,

Bhoobalan P.

 

 

 

 

 

 

Like 0

Like

1 comments

Hi Bhoobalan,

 

Please see this community post regarding the same question about ESQ and access rights - https://community.creatio.com/questions/access-issue-esq.

 

Best regards,

Oscar

Show all comments

Is there a declarative way to display fields from a lookup on an entity's edit page? For example, if I have a Contact record whose Owner field is set and I want to display the Owner's Job Title as a read-only field on the Contact's edit page, is it possible to do without adding some code to the onEntityInitialized method to manually set another attribute which a field is based on to the value of the Job Title field? I can load the field with the record using lookupListConfig as below, but any way I try to specify that this field should be displayed on the page results in errors or nothing happening:

    attributes: {
        "Owner": {
            lookupListConfig: {
                columns: ["JobTitle"]
            }
        }
    }
// ...
    diff: [
        // example of one attempted method to add the lookup field which doesn't work:
        {
            "operation": "insert",
            "parentName": "ContactGeneralInfoBlock",
            "propertyName": "items",
            "name": "OwnerJobTitle",
            "values": {
                "bindTo": "Owner.JobTitle",
                "layout": {
                    "column": 0,
                    "row": 4,
                    "colSpan": 12
                },
                "enabled": false
            }
        }
    ]

 

Obviously as mentioned this could be done using code, but if it's possible to do declaratively that would definitely be my preferred option - is this possible?

Like 0

Like

4 comments

I don't know of a declarative way to do this. You'd need this in a few parts:

  1. Add some text virtual attributes to the page and then add those to the diff as readonly
  2. Populate those attributes when a lookup item is selected which could be done by adding the columns to the lookupListConfig columns. You'd need to wire up a change attribute for the lookup to retrieve those values and populate the attributes.
  3. onEntityInitialized you'd need to retrieve those values using an ESQ to populate the virtual attributes again.

Ryan

As a side comment, I'd love to be able to declaratively add fields like this, the system could just make them read-only if they are on a connected entity. That would be fantastic.

Hi Ryan, thanks for the reply. Yeah, I have a way to populate the fields in code, but I was just wondering if there was a declarative way to do so - as you say, it would be a great addition to Creatio and I hoped I was just missing something already there!

 

For anyone else searching for this, my solution slightly differed from yours in using the lookupListConfig to pull the lookup entity's additional field(s) when loading the record, which means you don't have to run an additional ESQ, which saves hits on the DB. It also uses the dependencies attribute rather than the change attribute, but that's just my personal preference as I believe they'd work the same:

 

    attributes: {
        "Owner": {
            lookupListConfig: {
                columns: ["JobTitle"]
            }
        },
        "OwnerJobTitle": {
            type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
            dataValueType: Terrasoft.DataValueType.TEXT,
            dependencies: [
                {
                    columns: ["Owner"],
                    methodName: "setPickMapFields"
                }
            ]
        }
    },
    methods: {
        onEntityInitialized: function() {
            this.callParent(arguments);
            this.setPickMapFields();
        },
 
        setPickMapFields: function() {
            const owner = this.get("Owner");
            if(owner) {
                this.set("OwnerJobTitle", owner.JobTitle.displayValue);
            } else {
                this.set("OwnerJobTitle", null);
            }
        }
    },
    diff: [
        {
            "operation": "insert",
            "parentName": "ContactGeneralInfoBlock",
            "propertyName": "items",
            "name": "OwnerJobTitle",
            "values": {
                "bindTo": "OwnerJobTitle",
                "layout": {
                    "column": 0,
                    "row": 4,
                    "colSpan": 12
                },
                "enabled": false
            }
        }
    ]

 

Does the job, but it does lack the clarity that a declarative system would provide!

Harvey Adcock,

That's great Harvey, thanks for the update. I was under the impression that adding columns to the lookupListConfig would only load them on selection, great to know that those come along when the lookup data is loaded as well!

Ryan

Show all comments

Hi all,

       I add an attribute which type is LOOKUP to a custom page like this

      attributes: {

                  "ContactId": {

                          "dataValueType": this.Terrasoft.DataValueType.LOOKUP,

                          "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                   }

      }

 

      And then, I want its datasource is Filtered Contacts with condition is "he/she has mobile phone number". I know "lookupListConfig", but can't set Contacts is the datasource. Please help me to do that.

Many thanks

Like 0

Like

4 comments

From where I stay it's much easier to add the "contact" column into the related object and then apply the filtration with a business rule. 

attributes: {
"WO": {
	dataValueType: this.Terrasoft.DataValueType.LOOKUP,
	type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
	caption: "Some caption",
	hideActions: true,
	value: {
		value: "",
		displayValue: ""
	},
	referenceSchema: {
		name: "Contact",
		primaryColumnName: "Id",
		primaryDisplayColumnName: "Name"
	},
		referenceSchemaName: "Contact"
}
}
methods{
 
setWO: function(){
   this.set("WO", XXXXXXXXXXXX)
}
}

 

Eugene Podkovka,

Hi Eugene,

        Because I did a custom campaign element, I don't have any object to add relationship to Contact.

https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-custom-…

Thanks

Kirill Krylov CPA,

Hi Kirill

    It works well

Thanks

Show all comments