Hi,

I am trying to update a lookup field linked to Owner field of Accounts (Lookup to Contacts) for multiple records using an input box, which is added as custom action. But, the list of records are not displaying either by typing in the field or clicking on magnifying glass icon.

 

I have tried multiple way to bind attributes and diff but no progress, therefore I have attached the code snippet of this custom action for reference.

 

I appreciate if you can suggest a way to tackle this issue.

Thanks,

 

File attachments
Like 0

Like

5 comments
Best reply

Hi Kavian,

 

The code below will do the trick:

define("AccountSectionV2", [], function() {
	return {
		entitySchemaName: "Account",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		attributes:{},
		methods: {
			updateAccount: function(callback, autoIds, selectedContact){
				var update = Ext.create("Terrasoft.UpdateQuery", {
                            rootSchemaName: "Account"
                        });
				var filters = Terrasoft.createFilterGroup();
				filters.logicalOperation = Terrasoft.LogicalOperatorType.OR;
				autoIds.forEach(function(item) {
					var accountIdFilter = update.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Id", item);
					filters.add("AccountIdFilter" + item, accountIdFilter);
				}, this);
				update.filters.add(filters);
				update.setParameterValue("Owner", selectedContact, Terrasoft.DataValueType.LOOKUP);
				update.execute(function(result) {
					callback.call(this, result);
				}, this);
			},
			getSectionActions: function() {
				var actionMenuItems = this.callParent(arguments);
				actionMenuItems.addItem(this.getButtonMenuItem({
					"Caption": {bindTo: "Resources.Strings.MultiplyChangeAction"},
					"Click": {bindTo: "showOwnerInfo"}
				}));
				return actionMenuItems;
			},
			showOwnerInfo: function() {
                var caption = "Select an owner";
                var ContactList;
                this.set("ContactList", new Terrasoft.Collection());
                var controls = {
                    "Owner": {
                        dataValueType: Terrasoft.DataValueType.ENUM,
                        isRequired: true,
                        caption: "Owner",
                        value: {
                            bindTo: "Contact"
                        },
                        customConfig: {
                            list: {
                                bindTo: "ContactList"
                            },
                            prepareList: {
                                bindTo: "onPrepareContactList"
                            }
                        }
                    }
                };
                var ownerInputBoxHandler = this.ownerInputBoxHandler.bind(this);
                Terrasoft.utils.inputBox(caption, ownerInputBoxHandler, [
					{
						className: "Terrasoft.Button",
						caption: "ASSIGN",
						returnCode: "ok"
					}, "cancel"
				], this, controls);
                Terrasoft.each(Terrasoft.MessageBox.controlArray, function(item){
                    item.control.bind(this);
                }, this);
            },
            onPrepareContactList: function(){
                var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Contact" });
                esq.addColumn("Id");
                esq.addColumn("Name");
                esq.getEntityCollection(function(result){
                    if (result.success){
                        var items = {};
                        result.collection.each(function(item) {
                            items[item.get("Id")] = { "value": item.get("Id"), "displayValue": item.get("Name") };
                        }, this);
                    }
                    var list = this.get("ContactList");
                    list.loadAll(items);
                }, this);
            },
            ownerInputBoxHandler: function(tag, data){
				var autoIds = this.getSelectedItems();
				var selectedContact = data.Owner.value;
                if (Terrasoft.MessageBoxButtons.OK.returnCode === tag){
                    if (Ext.isEmpty(selectedContact)){
                        this.showInformationDialog("Field is required", function(){
                            this.showOwnerInfo();
                        });
                    } else {
                        this.updateAccount(function(context, result){}, autoIds, selectedContact);
                    }
                }
            }
		}
	};
});

You will be able to select an owner from contacts:

and the selected records will be updated properly.

 

Best regards,

Oscar

Hi Kavian,

 

The code below will do the trick:

define("AccountSectionV2", [], function() {
	return {
		entitySchemaName: "Account",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		attributes:{},
		methods: {
			updateAccount: function(callback, autoIds, selectedContact){
				var update = Ext.create("Terrasoft.UpdateQuery", {
                            rootSchemaName: "Account"
                        });
				var filters = Terrasoft.createFilterGroup();
				filters.logicalOperation = Terrasoft.LogicalOperatorType.OR;
				autoIds.forEach(function(item) {
					var accountIdFilter = update.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Id", item);
					filters.add("AccountIdFilter" + item, accountIdFilter);
				}, this);
				update.filters.add(filters);
				update.setParameterValue("Owner", selectedContact, Terrasoft.DataValueType.LOOKUP);
				update.execute(function(result) {
					callback.call(this, result);
				}, this);
			},
			getSectionActions: function() {
				var actionMenuItems = this.callParent(arguments);
				actionMenuItems.addItem(this.getButtonMenuItem({
					"Caption": {bindTo: "Resources.Strings.MultiplyChangeAction"},
					"Click": {bindTo: "showOwnerInfo"}
				}));
				return actionMenuItems;
			},
			showOwnerInfo: function() {
                var caption = "Select an owner";
                var ContactList;
                this.set("ContactList", new Terrasoft.Collection());
                var controls = {
                    "Owner": {
                        dataValueType: Terrasoft.DataValueType.ENUM,
                        isRequired: true,
                        caption: "Owner",
                        value: {
                            bindTo: "Contact"
                        },
                        customConfig: {
                            list: {
                                bindTo: "ContactList"
                            },
                            prepareList: {
                                bindTo: "onPrepareContactList"
                            }
                        }
                    }
                };
                var ownerInputBoxHandler = this.ownerInputBoxHandler.bind(this);
                Terrasoft.utils.inputBox(caption, ownerInputBoxHandler, [
					{
						className: "Terrasoft.Button",
						caption: "ASSIGN",
						returnCode: "ok"
					}, "cancel"
				], this, controls);
                Terrasoft.each(Terrasoft.MessageBox.controlArray, function(item){
                    item.control.bind(this);
                }, this);
            },
            onPrepareContactList: function(){
                var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Contact" });
                esq.addColumn("Id");
                esq.addColumn("Name");
                esq.getEntityCollection(function(result){
                    if (result.success){
                        var items = {};
                        result.collection.each(function(item) {
                            items[item.get("Id")] = { "value": item.get("Id"), "displayValue": item.get("Name") };
                        }, this);
                    }
                    var list = this.get("ContactList");
                    list.loadAll(items);
                }, this);
            },
            ownerInputBoxHandler: function(tag, data){
				var autoIds = this.getSelectedItems();
				var selectedContact = data.Owner.value;
                if (Terrasoft.MessageBoxButtons.OK.returnCode === tag){
                    if (Ext.isEmpty(selectedContact)){
                        this.showInformationDialog("Field is required", function(){
                            this.showOwnerInfo();
                        });
                    } else {
                        this.updateAccount(function(context, result){}, autoIds, selectedContact);
                    }
                }
            }
		}
	};
});

You will be able to select an owner from contacts:

and the selected records will be updated properly.

 

Best regards,

Oscar

Oscar Dylan,

 

Thanks, the solution works perfectly.

Oleg Drobina,

Hi, 

The code works very well. I however need to display the list as a modal pop up instead of drop down. Could you please let me know what changes need to be done or point me to resources?

Hi 

how I could modify the code (onPrepareContactList) to add a filter to the contact list (only display who are users) !

Oleg Drobina,

Oleg Drobina,

Hi! Is there a way to update only the selected contacts that have Ownership Status = Active?

Show all comments

Hello,

I'm setting up the Mobile App with VERY FEW sections (contact, accounts, activities)

 

Since we have areas with no connection....I need to set the OFFLINE mode (using 7.17).

 

When I first start the APP, it seems to be loading ALL objects (orders, products, etc...) which take a lot of time/resources.

 

Can we RESTRICT some objects to be loaded when I don't use the section in the App ?

 

Hope I'm clear enough.

Thanks

 

Like 0

Like

2 comments

Hi Francois,

 

This usually happens if there are more than 1 workplace set for the Mobile App. The best way is to check your Mobile wizard and see if any of those sections linked to any of the workplaces.

I double checked and nothing is refering to the order. (I only kept Account/Contact/Activity/Lead.  The data that I'm showing does not call ORDERs or Products in Orders) 



But I still see :  Importing data (OrderProduct) = over 2 Millions records.

 

Can we limit the amount of Order records  (Today's data ONLY) ?

 

Show all comments

I want to put button beside the group. Is the structure of groups and details different?

Like 0

Like

2 comments

I was only able to put the button inside the ControlGroup, but not in the "tools" container since ControlGroups have no "tools" container (like standard details). The result was as follows:

It seems that its impossible to put the button beside the group, but it's possible to put it inside the group using the code like below:

{
				"operation": "insert",
				"name": "ContactCategoriesControlGroup",
				"parentName": "GeneralInfoTab",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.CONTROL_GROUP,
					"caption": {"bindTo": "Resources.Strings.ContactCategoriesControlGroupCaption"},
					"items": []
				},
				"index": 0
			},
			{
				"operation": "insert",
				"name": "ContactCategoriesControlGroupButton",
				"parentName": "ContactCategoriesControlGroup",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {bindTo: "Resources.Strings.ContactCategoriesControlGroupButtonCaption"},
					"style": Terrasoft.controls.ButtonEnums.style.BLUE
				}
			},
			{
				"operation": "insert",
				"name": "ContactCategoriesControlGroupContainer",
				"parentName": "ContactCategoriesControlGroup",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.GRID_LAYOUT,
					"items": []
				}
			},
			{
				"operation": "insert",
				"name": "RelatedContact",
				"parentName": "ContactCategoriesControlGroupContainer",
				"propertyName": "items",
				"values": {
					"bindTo": "UsrContact",
					"layout": {
						"column": 0,
						"row": 0,
						"colSpan": 12
					}
				}
			},

So either use this approach or add a button to the "Actions" menu or to the top of the page.

 

Best regards,

Oscar

Oscar Dylan,

 

I think for group and detail have the same environment. but apparently not.

Thanks for the answer Oscar!

Show all comments

Hi Community,

 

Case can be registered from case section, incoming email and mobile application. Case number is being populated automatically. We need to give different prefix for each. Currently all prefix are coming from system setting "Case number mask" and is being applied for all Cases. 

 

Please let us know to where we can find this function and how we can override it for us to customize it based on our requirements.

 

Thank you so much

Like 0

Like

6 comments

Hello Fulgen,

 

Thank you for your question!

 

This logic can be achieved with the help of a business process. Please see the screenshot below:

It should start with a signal Case Added (when a new case is created). The next element would be Read Data which will read all the data from the case. The data should be read from Category, ID, and Number columns. Please, don't forget to filter the cases by ID. Alternatively, the system will not understand which case to choose and will select the first available one.

 

Also, you need to set the following parameters here:

NewCaseNumber - Text (500 characters)

OldCaseNumber - Text (500 characters)

Prefix - Text (500 characters)

 

The next element would be Formula which will be dividing your cases in different flows. You will need to add the conditions according to which you would like to group your cases here. Please, select case category in order to separate the cases by the source they are registered from.

When setting up Formula element (#2), you will need to set the formula value to the following parameter: OldCaseNumber. The Formula value here will be [#Read case. First item of resulting collection.Number#]

 

The conditional flow (#3) should be filled in this way: [#Read case. First item of resulting collection.Category#]==[#Lookup.Case category.Incident.1b0bc159-150a-e111-a31b-00155d04c01d#]

 

The conditional flow (#4) is a default flow.

 

In Formula element (#5) you need to set the formula value to the following parameter: Prefix. The Formula value here will be, for example, “HY” (the needed prefix).

 

In Formula element (#6), please do the same as in the previous element, just set another prefix.

 

The seventh element is Script task (#7), its code is:

string oldCaseNumber = Get<string>("OldCaseNumber");

string prefixValue = Get<string>("Prefix");

string resultNumber = oldCaseNumber.Replace("SR", prefixValue);

Set<string>("NewCaseNumber", resultNumber);

return true;

 

The eighth element is Modify Data (#8) which will finally change the prefix. Please, filter the cases here by ID as well. In the field ‘Which column values to set for modified records please type [#NewCaseNumber#].

 

You can customize the process based on your tasks, but the basic structure is described above.

 

Hope this helps!

 

Kind regards,

Anastasiia

Anastasiia Lazurenko,



Thank you for your suggestion but I want to override the function before insert. From there I wanted to change the Case Number right away. Please guide me how can I override it?

Fulgen Ninofranco,

 

 You can either create a database trigger or you can create the same process that is triggered upon CaseInserting event in the Case object of the Case package, but in your custom package and change the logic of the sequence:

We don't have a practical example of the implementation so you will need to study the logic of this process and create your own process in the same way if you select EntityEvent option.

 

Best regards,

Oscar

Fulgen Ninofranco,

Oscar is pointing you to the correct direction.

 

Regarding the business case you mentioned, you can:

1. Remove the prefix in the system setting. Therefore no prefix will be attached to you case number, which is generated from the user task.



2. Create exact the same process as Oscar mentioned above. 

In the last step, "SetGeneratedNumberScript" apply your logic.

string code = string.Empty;

code = GenerateNumberUserTask.ResultCode;

//Apply your business logic for the prefix and attach the prefix to the generated code. So code = LogicPreifx + code;

if(!string.IsNullOrEmpty(code)) {

    Entity.SetColumnValue("Number", code);

}

return true;

 

Be careful that the case number will be will be generated on UI when you click on new case. So you need to disable the code generation on page or apply the same logic.

 

regards,

 

Cheng gong

 

 

Dear Fulgen, you have another choice, flexible on the Marketplace, is free, see it on https://marketplace.creatio.com/app/numerator-creatio

Hi Oscar Dylan,

I tried to follow your suggestion, in a standard package (no assembly package) I overrided the CaseInserting event by adding my business logic, but it doesn't work, the application calls the original version.

 

Show all comments

I am looking for a solution to render Unread Social Messages in List Dashboard and the records are expected to be in BOLD. 

 

Product Version  -  7.17.0.2164

Kindly Suggest.

Like 0

Like

2 comments
Best reply

You can add custom css to the section where the dashboard is placed with the code similar to the one below:

.dashboard-listed-grid-module .grid-primary-column{
	font-weight: bolder;
}

this will make the primary column for the dashboard to be in bold text:

All you need is to correctly specify paths to elements on the page in css.

 

Best regards,

Oscar

You can add custom css to the section where the dashboard is placed with the code similar to the one below:

.dashboard-listed-grid-module .grid-primary-column{
	font-weight: bolder;
}

this will make the primary column for the dashboard to be in bold text:

All you need is to correctly specify paths to elements on the page in css.

 

Best regards,

Oscar

Thanks Oscar Dylan, that worked.

Show all comments

Hi Community,

 

Is there an Out of the Box functionality in Creatio related to Facebook,

 

1. User can create post in CRM and it will be posted in Facebook

2. User can create message in CRM and it will be sent to Customer's Facebook Account.

 

Thank you

Like 0

Like

1 comments

Dear Fulgen,

 

Thank you for your question!

 

Unfortunately, there are no such functions as for Facebook integration yet. We've registered it in our R&D team backlog for consideration and implementation in future application releases.

 

Kind regards,

Anastasiia

Show all comments

Hi Everyone,

i need some help about adding photo on MS Word Report, i have add the Photo from the object but the photo is'nt showed in Word Report, it just only print the file name. Do you have any idea guys? 

Like 2

Like

2 comments

Dear Fransetya,

 

Thank you for your question!

 

You may find this community post useful for your needs:

https://community.creatio.com/questions/adding-product-image

 

Hope this helps!

 

Regards,

 

Danyil

Dear Danyil,

 

Thank you for your help, it's worked

Show all comments

Dear colleagues,

 

I'm getting from a week ago a "Request Timeout" each time I try to bind some data on a demo site.

 

I did it before, but from a week ago, I cannot anymore, some ideas?

 

See it on https://share.vidyard.com/watch/dpoVmZuUhAHbSS6NzaSnuj?

 

It's on Studio Enterprise 7.18, the version list isn't updated

 

Thank you very much

Like 0

Like

2 comments

Hello Julio,

 

The responsible team is working to fix this. The error appears due to the changes in the basic functionality in version 7.18.3. We plan to publish the updated package no later than the end of October.

Alexander Demidov,

Thank you very much @Alexander! :-)

 

Best regards

Show all comments

Hi Community,

 

This is related to when adding records in "subordinate cases" detail. I am getting error when client is calling this service "HierarchicalRecordSelectService" method "UpdateRecords". It is weird because this service exists on my configuration and this is Out of the box, we haven't done any customization into it. Any idea how to fix it?

 

Like 0

Like

3 comments

Hi Fulgen

 

Could you please share what do you have in response? 

 

Here might be additional information which is useful for investigation.

 

Thanks!

 

Bogdan L.

Dear Fulgen

 

In addition could you please contact our support at support@creatio.com  directly and give us the reproducing steps with the external access if you can't handle this issue yourself and we will definitely investigate the problem. 

 

Thanks!

 

Regards, 

 

Bogdan L.

Dear Fulgen,

 

As an suggestion please double check the request if you passed all the data correctly. 

 

Another variant, please make sure that user who tried to pass the data has permissions to add/edit the data to the object/detail.

 

Hopefully it helps!

 

Regards, 

 

Bogdan L.

Show all comments

Hi Community,

 

In case there is a way you can specify the Parent Case. Question if user will Resolve or Close the parent case record, what will happened to the Child Case record?

Like 0

Like

1 comments

Dear Fulgen, 



In case if the parent case is resolved or closed nothing will happen with subordinate case in case if you don't have any additional logic which would trigger on this event. 



These cases are separate cases and connection between Child and Parent cases were added for history and convenient usage purposes. 



Kind regards, 

Roman

Show all comments