Hi Team,

 

Could anyone please help me achieving the things below?

 

I have added two custom attributes in the client module.

 

One of lookup type and the other for text. As soon as the user selects the value in the Title Dropdown, the Description text field should be auto-populated with the corresponding value of description being fetched from a data source of Title.

 

The source lookup is as follows:

 

attributes: {

 "UsrTitle": {
         dataValueType: Terrasoft.DataValueType.LOOKUP,
         type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                  isSimpleLookup: true,

                   referenceSchemaName: "UsrTitle",

                   isRequired: true,
       },

          "UsrDescription": {
         dataValueType: Terrasoft.DataValueType.MAXSIZE_TEXT,
         type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, 
         value: ""
       }

}

 

    diff: [
                
                {
                    "operation": "insert",
                    "name": "MyMenu",
                    "propertyName": "items",
                    "values": {
                        "generateId": false,
                        "itemType": Terrasoft.ViewItemType.CONTAINER,
                        "items": []
                    }
                },
      
              {
         "operation": "insert",
         "parentName": "MyMenu", // The container where the input box will be added
         "propertyName": "items",
         "name": "UsrTitle",
         "values": {
           "bindTo": "UsrTitle", 
           "labelConfig": {
             "caption": "Title"
           },
         },
           "bindTo": "UsrTitle",
                    
                "enabled": true,
                    
                "contentType": 3
       },
                  
            {
         "operation": "insert",
         "parentName": "MyMenu", 
         "propertyName": "items",
         "name": "UsrDescription",
         "values": {
           "bindTo": "UsrDescription", 
           "labelConfig": {
             "caption": "Description"
           },
            "contentType": 0,
        "layout": {
            "column": 4,
            "row": 5,
            "colSpan": 20,
            "rowSpan": 4
        },
           "controlConfig": {
             "placeholder": "Enter your text here"
           },
           "classes": {
             "wrapClassName": ["custom-input-box-class"]
           }
         }
       },
         {
       "operation": "insert",
       "parentName": "MyMenu",
       "propertyName": "items",
       "name": "MainContactButton",
      
       "values": {
      
           "itemType": Terrasoft.ViewItemType.BUTTON,
         
           "caption":"Create Ticket",
           
           "enabled": true
       }
   },
 ]

 

 

Please note that this is a custom client module which does not belong to a section, hence not able to achieve this using the OOTB business rules. Kindly help!

 

Thanks,

Sarika

Like 0

Like

2 comments
Best reply

First of all, you'll need to have a change event for when the lookup attribute it selected, add something like this to the lookuip attribute: 

"UsrTitle": {
    dataValueType: Terrasoft.DataValueType.LOOKUP,
    type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
    isSimpleLookup: true,
    referenceSchemaName: "UsrTitle",
    isRequired: true,
    onChange: "getTitleDescription"
}

Then, add the getTitleDescription method to the methods. When a value is selected this will get called and you can go retrieve the description via an EntitySchemaQuery to set in the other attribute:

getTitleDescription: function() {
    var title = this.get("UsrTitle");
    // now do an esq to get the description using title.value and then set in the description attribute
}

You could try adding the Description to the lookup attribute's lookupListConfig to avoid the esq, but I am not sure if that works for a virtual lookup attribute. However, doing an esq there would work fine.

Ryan

First of all, you'll need to have a change event for when the lookup attribute it selected, add something like this to the lookuip attribute: 

"UsrTitle": {
    dataValueType: Terrasoft.DataValueType.LOOKUP,
    type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
    isSimpleLookup: true,
    referenceSchemaName: "UsrTitle",
    isRequired: true,
    onChange: "getTitleDescription"
}

Then, add the getTitleDescription method to the methods. When a value is selected this will get called and you can go retrieve the description via an EntitySchemaQuery to set in the other attribute:

getTitleDescription: function() {
    var title = this.get("UsrTitle");
    // now do an esq to get the description using title.value and then set in the description attribute
}

You could try adding the Description to the lookup attribute's lookupListConfig to avoid the esq, but I am not sure if that works for a virtual lookup attribute. However, doing an esq there would work fine.

Ryan

Ryan Farley,

 

Thanks. it worked.

Show all comments

Why is this not working? I am genuinely confuse.



Setting visibility using ESQ is not working. Am I missing something?

 

define("OpportunitySectionV2", ["ConfigurationConstants"], function(ConfigurationConstants) {
	return {
		entitySchemaName: "Opportunity",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		attributes: {
			"isSysAdmin": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
				value: false
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "DataGridActiveRowDeleteAction",
				"values": {
					"visible": {
						"bindTo": "isSysAdmin"
					}
				}
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onGridDataLoaded: function() {
				this.callParent(arguments);
				this.getUserRights();
			},
			getUserRights: function() {
				var scope = this;
				var currentUser = Terrasoft.SysValue.CURRENT_USER.value;
				var sysAdmins = ConfigurationConstants.SysAdminUnit.Id.SysAdministrators;
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SysUserInRole" });
				esq.addColumn("SysRole");
				esq.addColumn("SysUser");
				esq.filters.add("SysUser", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysUser", currentUser));
				esq.filters.add("SysRole", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysRole", sysAdmins));
				esq.getEntityCollection(function(response) {
					if (response && response.success) {
						var result = response.collection;
						var isSysAdmin = (result.collection.length !== 0);
						debugger;
						scope.set("isSysAdmin", isSysAdmin);
					}
				}, this);
			},
		}
	};
});

Thank you.

Solem A.

Like 1

Like

5 comments
Best reply

Solem Khan Abdusalam,

It's been a bit since I last tried this, but I've tried binding visible (and caption) of buttons in ActiveRowActions and they never seem to work. 

I do this instead: Check and store in the attribute if the user has the needed role. Then, in the method that adds the delete action, do something like this: 

getDeleteRecordMenuItem: function() {
    if (this.get("isSysAdmin")) {
        return this.callParent(arguments);
    }
}

This way, the delete button is never added since when the method is called, it only calls the parent if the user has the role. 

Note, you have to pre-fetch the user's role earlier, before the getDeleteRecordMenuItem is called. Since the ESQ is asynchronous you can't call it in within that method.

Ryan

hi Solem Khan Abdusalam,

 

Please call the getUserRights() method inside init : function() as below

init: function() {
    this.callParent(arguments);
    this.getUserRights();
},

Also, Object permission can be used to achieve the functionality (though the button is visible the operation to add, delete can't be performed).

 

 

BR,

Bhoobalan Palanivelu.

Bhoobalan Palanivelu,



Yes I disabled the role to delete but I need the button to disappear.

Will it work in init? It's ESQ. I tried doing this.set() in without the ESQ and it is not working. Is attribute binding not working anymore?



I am trying to remove the delete button in ListView at Section.

 

//

 

I tried removing methods just to test if attributes works, and it didn't

		attributes: {
			"isSysAdmin": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
				value: true
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "DataGridActiveRowDeleteAction",
				"values": {
					"visible": {
						"bindTo": "isSysAdmin"
					}
				}
			}
		]/**SCHEMA_DIFF*/,

 

Solem Khan Abdusalam,

It's been a bit since I last tried this, but I've tried binding visible (and caption) of buttons in ActiveRowActions and they never seem to work. 

I do this instead: Check and store in the attribute if the user has the needed role. Then, in the method that adds the delete action, do something like this: 

getDeleteRecordMenuItem: function() {
    if (this.get("isSysAdmin")) {
        return this.callParent(arguments);
    }
}

This way, the delete button is never added since when the method is called, it only calls the parent if the user has the role. 

Note, you have to pre-fetch the user's role earlier, before the getDeleteRecordMenuItem is called. Since the ESQ is asynchronous you can't call it in within that method.

Ryan

Ryan Farley,



Would this work on Section?

For a section you can override checkCanDelete to return a boolean indicating if the user can delete or not.  Sadly it won't remove the delete button, will instead just give them a message that they can't delete (which is how it works out of the box).

Ryan

Show all comments

Hi i want to make new duplicate search rule

I created a new workplace and added a new section. I wish it would look for duplicates for the records in this section. Which has the same order date, account and Opportunity

- created new order (object - zamowenia, add new order)

Like 1

Like

6 comments

Hello!



Please ensure that the duplicate search rules were added to the custom section according to the instruction.

The bulk duplicate search service works by Global Search service. Global Search can index only strings and lookup columns.

As a result, adding the deduplication rule to a DateTime column is not possible.

I don't have any attributes to add but I have got list page and form page

 

Arkadiusz Polus,

Please check the "Indexing for full-text search" parameter for the custom section in the Section wizard.

I created it in the application hub and I don't see such a checkbox anywhere

Arkadiusz Polus,

 

Unfortunately, Duplicate search rules cannot be added to a new section that was created in the Application Hub.

This functionality will be implemented in the 8.0.6 version.

thank you!

Show all comments

Hello community!

I need to set fields required based in values of a lookup at client side.

I was trying to test how isRequired works in attributes , but I found that the only way to work with it, is declaring the explicit value to True or False.

Tried to use a virtual column, and a method function, but it behaves weird.  

Here are my examples:

and this how it looks on screen:

 

It's showing the "Enter a Value" warning but they are supposed not to be required (* is missing).

 

Is there any way to workaround with this?

 

Thank you for your help.

Like 0

Like

3 comments
Best reply

Cesar Jaramillo,

Let's see what method of making fields required* dynamically actually works good – it is using rules/businessRules.

You can create a rule for your field, the condition can be any value of the page and its related lookups.

Like here:

But if you have to do this for several fields, it will take much time to set them for each field. 

And if there are many conditions or they are too complex, "businessRules" abilities can be not enough.

But we can set an attribute (boolean) to be a condition for each of these rules, like here:



The attribute value can be changed dynamically using "methods".

 

So here's what i'd advise you to do:



In my example the fields "Email" and "Preferred language" become required, if the contact Type is "Customer" and the "Owner" field is not empty.

1. Add an attribute of type BOOLEAN

attributes: {
	"FullInfoRequired": {
		"dataValueType": Terrasoft.DataValueType.BOOLEAN,
		"dependencies": [
			{
				"columns": ["Owner", "Type"],
				"methodName": "setFullInfoRequired"
			}
		]
	}
},

Each time any of the columns ("Owner" or "Type") is changed, the method "setFullInfoRequired" is called.

2. Add the method

setFullInfoRequired: function() {
	var type = this.get("Type");
	// ContactType.Client is a GUID for "Customer" type
	if (type.value === confConsts.ContactType.Client && this.get("Owner")) {
		this.set("FullInfoRequired", true);
	}
	else this.set("FullInfoRequired", false);
}

To set the attribute on page loading, immediately after the page loaded its data, you should also call this function in "onEntityInitialized":

onEntityInitialized: function() {
	this.callParent(arguments);
	this.setFullInfoRequired();
}

3. Add the rules using Page designer, as in my 2nd screenshot, for each field that should become required.

 

If the conditions are simple, just use businessRules as in the 1st screenshot.

 

Hello Cesar,

 

The isRequired attribute that uses the value that method returns works correctly in my local app (using bindTo: {"method name here"}). It seems that there is either some other custom logic related to these columns in the ContactPageV2 or maybe custom CSS that hides these * symbol. You need to look through all the logic related to these columns where you need to have the * symbol.

 

Best regards,

Oscar

Oscar Dylan,

Hi Oscar,  In my case, when the method returns True it works fine, but when it returns False, the * is gone, but the warning remains and it doesn't allow to save.  In what version did you try it?

Thanks!

Cesar Jaramillo,

Let's see what method of making fields required* dynamically actually works good – it is using rules/businessRules.

You can create a rule for your field, the condition can be any value of the page and its related lookups.

Like here:

But if you have to do this for several fields, it will take much time to set them for each field. 

And if there are many conditions or they are too complex, "businessRules" abilities can be not enough.

But we can set an attribute (boolean) to be a condition for each of these rules, like here:



The attribute value can be changed dynamically using "methods".

 

So here's what i'd advise you to do:



In my example the fields "Email" and "Preferred language" become required, if the contact Type is "Customer" and the "Owner" field is not empty.

1. Add an attribute of type BOOLEAN

attributes: {
	"FullInfoRequired": {
		"dataValueType": Terrasoft.DataValueType.BOOLEAN,
		"dependencies": [
			{
				"columns": ["Owner", "Type"],
				"methodName": "setFullInfoRequired"
			}
		]
	}
},

Each time any of the columns ("Owner" or "Type") is changed, the method "setFullInfoRequired" is called.

2. Add the method

setFullInfoRequired: function() {
	var type = this.get("Type");
	// ContactType.Client is a GUID for "Customer" type
	if (type.value === confConsts.ContactType.Client && this.get("Owner")) {
		this.set("FullInfoRequired", true);
	}
	else this.set("FullInfoRequired", false);
}

To set the attribute on page loading, immediately after the page loaded its data, you should also call this function in "onEntityInitialized":

onEntityInitialized: function() {
	this.callParent(arguments);
	this.setFullInfoRequired();
}

3. Add the rules using Page designer, as in my 2nd screenshot, for each field that should become required.

 

If the conditions are simple, just use businessRules as in the 1st screenshot.

 

Show all comments

In an edit page, we have fields that can be changed by the user or calculated by the page Javascript code, depending on specific circunstamces.

In this case we need to inhibit the attribute dependency method call, to make sure it is not called when the field is calculated by the page code, and not by the user.

Is it possible ?

Regards,

Like 0

Like

3 comments

Hi Ricardo,

 

Everything is simple - these specific circumstances should be included into the logic of custom method calls inside the JavaScript code. So the logic itself should be redesigned.

 

Best regards,

Oscar

Oscar Dylan,

Ok, but what I am looking for is a way of disabling the handler method activation in the attribute dependency, so that when the field is updated by the code the handler method will not be triggered... The Javascript code would first disable the dependency method call, update the field, and then enable the dependency control again.

Ricardo Bigio,

One way to accomplish that is to add a property or attribute to the code where you can set a flag that the field is being updated via code, then in the event handler, check this flag to see if you should exit or continue The flag would only get set by code, so the user entering a value the flag won't be set and the event handler will trigger normally. Something like this:

suppressEvent: false,
 
funcThatSetsDependentColumn: function() {
    this.suppressEvent = true; // set flag to suppress the event
    this.set("UsrDependentColumn", value); // set the column that will trigger the event
},
 
dependentColChangeHandler: function() {
    // check if flag is set to suppress the event
    if (this.suppressEvent) {
        this.suppressEvent = false; // unset the flag and exit
        return;
    }
 
    // do other stuff in the event handler here
}

Hope this helps,

Ryan

Show all comments

Changes on attributes dependencies are not being triggered on my detail edit page. Any reason for that ?

regards,

Like 0

Like

1 comments

Ricardo,

 

It's really hard to understand the issue completely without the code of the detail edit page and without the logic that the code represents. Can you please provide us with it?

 

Best regards,

Oscar

Show all comments



Dear Community,



I was wondering if there's a comprehensive list somewhere where we can find all the attributes for the schema page.

Some of the examples are:

- In diff we can add different things like

"operation": "delete",

                    "name": "",

                    "propertyName": "",

                    "parentName": "",

                    "values": {}

Where can I find a list of things I can put in the Diff and "values"?

Same thing for messages, attributes, ...



Thank you in advance!

Like 0

Like

3 comments

Hi Yosef,

 

You can find the chain of articles here that describes multiple schema configurations:

https://academy.creatio.com/documents/technic-sdk/7-16/introduction-3

The diff array article among others describes the possbile operations that you refer to

https://academy.creatio.com/documents/technic-sdk/7-16/diff-array

 

Regards,

Dean

dean parrett,



Thank you for the quick response but this isn't exactly what I'm looking for, it sure is a great start for beginners!



What I'm looking for is like an "extended" list. If I want to enable or disable an item, I would be adding the ' "enable": true ' to the diff. This is nowhere to be found on the second link.



While programming I found bits and pieces of information of these properties in different posts, but I'm looking for something more complete in one place.



If anyone knows or has made a list like this, please let me know!

Thank you

Show all comments

Can we add columns of an object to be selected in a custom lookup, similar to the data validation lookup? 

For e.g. in one lookup, can I have column Name, object and attribute where object = contact and attribute will have values as the columns in contact object.

Like 0

Like

1 comments

Dear Krishna, 



The mentioned data entry compliance lookup and it's functionality is build upon a few separate objects in "Completeness" package. 

In order to create the same lookup or implement the similar functionality you will have to check objects and pages from this package and create a new object with the same parameters upon which the new lookup will be created. 



Kind regards,

Roman

Show all comments

Hello, 

 

I am trying to edit the schema for a page (Quotes) to grab the connected project's contact and account names with the attribute and method properties.

 

So far my code is grabbing the name, but it is not being set correctly. As well, the contact title for the page is disappearing when I add the attribute.KwlContact bit 

Hello, 

 

I am trying to edit the schema for a page (Quotes) to grab the connected project's contact and account names with the attribute and method properties.

 

So far my code is grabbing the name, but it is not being set correctly. As well, the contact title for the page is disappearing when I add the attribute.KwlContact bit 

 

This is the result:

 

If I comment out the  attribute.KwlContact bit I get this:

 

What am I missing to get this code to work?

Like 0

Like

Share

1 comments

Dear Philip,

First. An attribute doesn't know what is "onChanged" property. To launch a method when an attribute is changed use "dependencies" property:

 attributes: {

            "KwlContactName": {

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

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

                "columnPath": "KwlProject.Contact.Name",

                "caption": {bindTo: "Resources.Strings.KwlContactCaption"},

                "dependencies": [

                    {

                        "columns": [ "KwlProject" ], // columns that trigger a call

                        "methodName": "onSomePropertyChanged"

                    }

                ]

            }

        },

Second. You cannot write project["Contact.Name"] because project variable doesn't have anything but value and display value fields. You should use client EntitySchemaQuery to read new contact name and set it to KwlContactName in async way.

Third. It seems you have an issue with localizable string. Maybe it doesn't exist or you didn't specified a value for language of user's profile.

Show all comments