Hi

I have applied filtration logic for one Contact lookup field in a section edit page based on User Role and role-based contacts alone getting listed in that field. But when I put the same filter in portal edit page of the section for the same lookup field, it is not showing the contacts. 

Please find below the used code.

Case: Users having Role Id : 'KYC', has to be listed in the lookup field.

Filter code:  Inside Attributes,

"GlbKYC": { 

// Attribute data type.

"dataValueType": Terrasoft.DataValueType.LOOKUP,

// The configuration object of the LOOKUP type.

"lookupListConfig": {

"filters": [

function() {

var filterGroup = Ext.create("Terrasoft.FilterGroup");

filterGroup.add("IsKYC",

Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "[SysAdminUnit:Contact].[SysAdminUnitInRole:SysAdminUnit].SysAdminUnitRoleId", "C14E5787-4BF5-4FA8-A407-96FB942A02E2"));

return filterGroup;


}]}},

Kindly help to resolve this.

 

Regards

Abinaya

Like 1

Like

1 comments

Hi Abinaya,

 

SysAdminUnit object is not accessible from the portal due to security reasons and creating filtration using this object is not possible for portal users. Also it is not recommended to use "Sys" objects on the portal since system objects have restrictions in the application core related to the portal.

 

You need to create a separate object to store connections between system users, their roles and contacts. This custom object will be accessible from the portal and you will be able to execute filtration under a portal user.

 

Best regards,

Oscar

Show all comments

In my Lookup it must show only those contacts who have Specific role.

Example:

Contact-1 , Contact-2 are present

Contact-1 Have Role-1 and contact-2 will have Role-2

Lookup must show only Contacts with Role-1 . 

If not possible Can we have workaround for this .

 

In my Example it will show all contacts who are system users.

for these i want to filter collection based on role.

I tried this Please let me know the changes needed.

"lookupListConfig": {

                    // Array of filters used for the query that forms the lookup field data.

                    "filters": [

                        function() {

                            var filterGroup = Ext.create("Terrasoft.FilterGroup");

                            // Adding the "IsUser" filter to the resulting filters collection.

                            // The filter provides for the selection of all records in the Contact core schema

                            // to which the Id column from the SysAdminUnit schema is connected, for which

                            // Id is not equal to null.

                            filterGroup.add("IsUser",

                                Terrasoft.createColumnIsNotNullFilter("[SysAdminUnit:Contact].Id"));

                                                        // Adding the "IsActive" filter to the resultant filters collection.

                            // The filter provides for the selection of all records from the core schema.

                            // Contact to which the Id column from the SysAdminUnit schema, for which

                            // Active=true, is connected.

                            filterGroup.add("IsActive",

                                Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.EQUAL,

                                    "[SysAdminUnit:Contact].Active",

                                    true));

                            return filterGroup;

                        }

                    ]

                }

            }

Like 0

Like

1 comments

Dear Sushma,

In order to check whether a contact has particular role you need to create a query to the SysAdminUnitInRole table. Basically setting up the filter to check whether current user has the needed role in SysAdminUnitInRole table.

Please modify your filter settings to read from correct table. Also, please see the article below, which describes how to create queries to the database. (particularly Definition of root schema. Creation of paths to columns against root schema. Examples.)

https://academy.bpmonline.com/documents/technic-sdk/7-13/use-entitysche…

Regards,

Anastasia

Show all comments