Hi

I'm trying to show administrators only for the Account's Owner field.

I'm following this tutorial: https://academy.bpmonline.com/documents/technic-sdk/7-13/using-filtration-lookup-fields-examples

How can I filter the contact list to show system administrators only?

 

Thank you

Like 0

Like

6 comments

Dear Mohamed,

You have chosen a correct article to implement such functionality. You need to apply filtration for the Contact lookup field. The filter for filter group should be referring SysAdminUnit table and check whether contact has system administrator role. You can evaluate by system administrator role Id. 

Regrads,

Anastasia

Anastasia Botezat writes:

You need to apply filtration for the Contact lookup field. The filter for filter group should be referring SysAdminUnit table and check whether contact has system administrator role. You can evaluate by system administrator role Id. 

That's exactly what I did. But the SysAdminUnit table doesn't have RoleId column.

I looked into SysUserInRole table that contains SysRoleId and SysUserId columns, but I couldn't use it in the filter group.

Do you have any idea how to implement it?

Thank you

Mohamed

Mohamed,

Thank you for the explanation, now I see what you are referring to. The table, which contains the pair contact - role is SysAdminUnitInRole. There are stored pairs SysAdminUnitId and SysAdminUnitRoleId. Both are Ids from SysAdminUnit table.

Regards,

Anastasia

Anastasia Botezat,

Yes. I have to join the Contact, SysAdminUnit, and SysAdminUnitInRole to get the list of Administrators.

In SQL it looks like this:

select * from Contact 
left join SysAdminUnit on Contact.Id = SysAdminUnit.ContactId
left join SysAdminUnitInRole on SysAdminUnit.Id = SysAdminUnitInRole.SysAdminUnitId
where SysAdminUnitRoleId = 
'83A43EBC-F36B-1410-298D-001E8C82BCAD' 
-- sys administrators role id



 How can I use it in filters?

Thank you

Mohamed

Mohamed Ouederni,

Please check the following article on how to build path to the columns:

https://academy.bpmonline.com/documents/technic-sdk/7-14/root-schema-building-paths-columns

The path should be somewhat like this, and be evaluated to the role Id.

Contact.[SysAdminUnit:Contact].[SysAdminUnitInRole:SysAdminUnit].Role

Please use the article and example to build needed path.

Anastasia

Anastasia Botezat,

Thank you. That helps a lot.

For anyone interested in the solution.

filterGroup.add("IsAdmin",
Terrasoft.createColumnFilterWithParameter(
	Terrasoft.ComparisonType.EQUAL,
	"[SysAdminUnit:Contact].[SysAdminUnitInRole:SysAdminUnit].SysAdminUnitRoleId",
	"83A43EBC-F36B-1410-298D-001E8C82BCAD"));

 

Show all comments

we need to customize the modal box shown when we need to select for example Account lookup, by adding fixed filters on the top then the search button gets Accounts based on this filter.

Also can we hide the New Button here ?

will this customization affect other lookup selection modal box? 

if this is not applicable is there any other approach ? 

 

Like 0

Like

6 comments

Dear Ayman,

You can add a fixed filter to the lookup page, however, this requires development skills. Please see this article with instructions: 

https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-quick-filter-block-section

The schema you would need to modify is LookupPageViewGenerator. Please note, that applied changes would be displayed for all sections and each place where you use lookup page.

In order to remove New button, you need to override the getSelectionControlsConfig and getEditionControlsConfig methods on LookupPageViewGenerator schema and remove add button from there.

As an alternative approach, you can apply business rule on the field and in this case lookup would be automatically filtered. 

Regards,

Anastasia

Hi Anastasia,

I can't create "replacing client module" with parent is LookupPageViewGenerator. How can I "modify" it as you said? I found lookup Brand and Category in ProductPageV2 which hide button "New" when open its lookup modal. How can I see their source code?

Thanks

Anastasia Botezat,

Please help

Toan Mai,

Hello!



If you want to hide 'NEW' button you can simply add  "hideActions": true to your lookuplistconfig property of the attribute correspondent to lookup field.



Please see snippet below:

define("OrderPageV2", [], function() {
	return {
		entitySchemaName: "Order",
		attributes: {
			"Opportunity": {
				"lookupListConfig": {
					"hideActions": true
				}
			}
		},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});



It will however also hide actions drop down, but this drop down is also connected to crud operations within lookup field.



See result here:

https://prnt.sc/px04je

 

 

Dmytro Smishchenko,

This solution seems to work on lookup object in Order section. How can we implement the same on the Detail ?

hi ayman ,  can you send me code for this model box

Show all comments

Hi,  

I have the following multiple filters working in a lookup:

 

"filters": [

                        function() {

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

                           

                            filterGroup.add("Segment",

                                Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.EQUAL,

                                    "GlgSegment",this.get("GlgSegment").value));

                            

                            filterGroup.add("SegmentLeaderRole",

                                Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.EQUAL,

                                    "Role","A25AD3ED-1095-4774-91E1-54BED571EA3B"));        

                                    

                                    

                            return filterGroup;

                        }

                    ]

 

I need to add another filter but ordering the filters in the following logical operation:

Segment AND (Role OR Role)

Looking forward to your comments. 

Regards, 

Javier

 

 

 

Like 0

Like

2 comments

Just found the solution to this problem in the following thread:

https://community.bpmonline.com/questions/lookup-field-filter

Javier Collazo,

You can also take a look at this chunk of code, it also represents the combination of two filter groups. The idea is to make firstly one filter group for OR clause. Afterwards, you create a second filter group, which combines a first one OR and other clause. By default filters are added via AND.

getCurrentUserAndTypesFilter: function() {

   var filterGroup = new this.Terrasoft.createFilterGroup();

   filterGroup.logicalOperation this.Terrasoft.LogicalOperatorType.OR;

   var innerFilterGroupCreatedBy = new this.Terrasoft.createFilterGroup();

   innerFilterGroupCreatedBy.add("CurrentUser"this.Terrasoft.createColumnFilterWithParameter(

      this.Terrasoft.ComparisonType.EQUAL"Tag.CreatedBy",this.Terrasoft.SysValue.CURRENT_USER_CONTACT.value));

   innerFilterGroupCreatedBy.add("PrivateType"this.Terrasoft.createColumnFilterWithParameter(

      this.Terrasoft.ComparisonType.EQUAL"Tag.Type", TagConstants.TagType.Private));

   var innerFilterGroupOtherTypes = new this.Terrasoft.createFilterGroup();

   var types = [TagConstants.TagType.Corporate, TagConstants.TagType.Public];

   innerFilterGroupOtherTypes.add("OtherTypes",this.Terrasoft.createColumnInFilterWithParameters(

      "Tag.Type", types));

   filterGroup.addItem(innerFilterGroupCreatedBy);

   filterGroup.addItem(innerFilterGroupOtherTypes);

   return filterGroup;

},

Regards,

Anastasia

Show all comments

Hi,

There are default section filters available in all sections. But customisation can be done to include other filters also. For example, adding 'Status' field as default filter in orders section.

You can also set default value for the status filter so that only orders with that status will list in the grid.

We have created a blog where step by step explanation on  how to create custom section filters in orders section for 'status' field is given 

http://agiliztech.com/2019/03/25/bpmonline-custom-section-filters/

Like 1

Like

Share

6 comments

Hi Sriraksha, Nice post, I was looking for something like this and am implementing it at a customer. I have 2 questions that maybe you can help:

1) where is the documentation for the " initFixedFiltersConfig" method? where can I find all parameteres that are accepted by the method? I tried to find it here https://academy.bpmonline.com/api/jscoreapi/7.12.0/index.html but without success.

2) I actually need the filter to return a subset of a columnfor the values available to be chosen. Something like this:

columnName: “Owner”,

AND

"OwnerIsAproved" == true

Do you know how I could achieve this?

 

Thanks in advance,

Luis

Luis Tinoco Azevedo,

1) There is no documentation regarding the initFixedFiltersConfig method due to the fact that the method is in the configuration. Please use Ctrl+Shift+F in a browser developers console and you'll find it. Please read the code and you'll find all the information about the method.

The jscoreapi documentation describes only core methods that you can find neither in the configuration nor in the browser. The methods are in all-combined.js.

2) If you need complex filters it's much easier to use dynamic folders. You can configure them according to your needs and save them. 

Hi Eugene,

Thanks for the feedback.

1) It's clearer now why it does not show on the jscoreapi.

2) I understand the dynamic folders sugestion, I have 2 comments , that has made us look for another solution:

a) Dynamic fitlers are easy for me to setup but are not very intuitive for some end users

b) In this specific case we need to have dinamic filters for the combination of 2 variables: "Empresa Rangel"(a subset of Account's that has made post the question on how to get this subset) and "tipo de sinistro", and the filters need to work in such a way that I need to quickly change between all combinations of these 2 variables. If I create all of the necessary combinations I'll have to create 45 advanced filter folders which is not very practical.

The implementation so far is almost has I need it to work with 2 extra filters:

I just need that the filter on the account returns only the accounts that match a true boolean ("empresa Rangel" == true) in the account section.

Any help on how I could achive this?

Thanks in advance

In order to achieve the goal please add a checkbox and a method that will check the checkboxes' state each time it's changed. Please find an example in the case section. There is a checkbox called "Show closed cases" that does the mentioned functionality.

 

Hi can we add text filter for eg: I want to add custom filter for Customer name that will be a text can it be done? 

Bhumika Bisht,

 

Hi,

 

Using initFixedFiltersConfig method I am not sure if it's possible, however there is such filtration in the Product catalogue where you can input product name and only products with the needed name will be shown. What should be studied is the logic behind QuickSearchModule module in the ProductSelectionSchema. I was able to replicate it in the Orders section:

and (for example searching for ORD-4):

Pay attention to getQuickSearchFilterConfig, onQuickSearchFilterUpdate, handleFilterForGridDataView and _clearGridData methods there, properly override the loadGridData method, specify UpdateQuickSearchFilter and QuickSearchFilterInfo messages and you should be able to get the same result.

Show all comments

I Have an exisiting filter

var filter =

                this.Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,

                "Name", "Motherboards");

 

Name = Motherboards

 

Now I want to create multiple filter like:

Name = Motherboards or Name = Graphics Card or Name = Mouse

How can i do this one?

 

Like 0

Like

1 comments

Hello,

You need to create a filter group and set OR logical operator.

Please, see my example:



var filterGroup = this.Terrasoft.createFilterGroup();

filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.OR;

filterGroup.add("MotherboardsFilter", this.Terrasoft.createColumnFilterWithParameter(

                    this.Terrasoft.ComparisonType.EQUAL,

                     "Name", "Motherboards");

filterGroup.add("GraphicsFilter", this.Terrasoft.createColumnFilterWithParameter(

                    this.Terrasoft.ComparisonType.EQUAL,

                     "Name", "Graphics");

filterGroup.add("MouseFilter", this.Terrasoft.createColumnFilterWithParameter(

                    this.Terrasoft.ComparisonType.EQUAL,

                     "Name", "Mouse");  



You can find more examples in the documentation - https://academy.bpmonline.com/documents/technic-sdk/7-12/entityschemaqu…

Show all comments

I have a look up window which populates data of ProductType (Please see image below)

 

 

Upon displaying the modal look up window, Now I want it already filtered by default. I want only specific data will be displayed. 

Like 0

Like

3 comments

Dear Fulgen,

Please see the example below:

// Action handler method. Opens the [Contacts] lookup.
	setOwner: function() {
	// Defining the lookup configuration.
		var config = {
		  // The [Contact] Schema.
		  entitySchemaName: "Contact",
		  // Multiple selection is disabled.
		  multiSelect: false,
		  // The displayed column — [Name].
		  columns: ["Name"]
	     };
	     var EmployeeFilter = 
         this.Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Type.Name",
		 "Employee");
		 EmployeeFilter.Name = "existsFilter";
		 config.filters = EmployeeFilter;
// Opening of the lookup with certain configuration and call-back function that is triggered
// after you click [Select].
		 this.openLookup(config, this.lookupCallback, this);
	},

Hope you will find it helpful.

Regards,

Anastasia

Anastasia Botezat,

Good Day Anastasia,

 

What does parameters "Type.Name" and Employee represents?



I want my look up to like this one (please see image below).

Default filter - "Category"

Default filter value - "Hardware";

 

Thanks

Dear Fulgen,

Base on my example, the "Type.Name" and Employee says, that filter will display contacts, whose type is Employee. You can adjust the filter up to your needs.

Regards,

Anastasia

Show all comments