Hi,

My case is to construct this query : 

select SUM("UsrAmountForTheMonth")  from table abc where agent = 'A' and client = 'B' and resolved != 'C'

 

agent , client and resolved all three are lookup column and UsrAmountForTheMonth is of decimal type.

 

I have to do it on the frontend i,e using Edit page schema. I have written the below code but nothing pop up on the screen when I refresh and open the record. 

I want to understand where I am making mistake . It should in esq query formation.

 

Please help,

Many thanks,

Akshit.

 

Like 0

Like

3 comments

Dear Akshit, 

 

Here is an example of the query that you want to build (instead of your object and columns I used OOB Order columns for testing): 

 

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "Order"
});
esq.addColumn("DeliveryType");
esq.addColumn("Status.Name");
esq.addColumn("PaymentType");
esq.addColumn("Amount");
 
esq.filters.logicalOperation = Terrasoft.LogicalOperatorType.AND;
 
var esqFirstFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "DeliveryType", "50DF77D0-7B1F-4DBC-A02D-7B6EBB95DFD0");
var esqSecondFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "PaymentType", "0026BDE9-932B-4BAA-BA30-FFA521A255AB");
var esqThirdFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.NOT_EQUAL, "Status.Name", "2. Confirmation");
 
esq.filters.add("esqFirstFilter", esqFirstFilter);
esq.filters.add("esqSecondFilter", esqSecondFilter);
esq.filters.add("esqThirdFilter", esqThirdFilter);
 
esq.addAggregationSchemaColumn("Amount", Terrasoft.AggregationType.SUM, "AmountSum");
 
esq.getEntityCollection(function (result) {
    if (!result.success) {
        console.log("Data query error");
        return;
    }
	if (result.collection.getByIndex(0)){
		console.log(result.collection.getByIndex(0).get("AmountSum"));
	}
	else {
		console.log("0");
	}
}, this);

Best regards, 

Dennis 

Hi Dennis Hudson,

 

If I am using  " esq.addColumn(TitleNameOfLookupColumn) " It shows "Data query error"  : please look at the first snap for this.

 

With little changes in the condition and "esq.addColumn(DB Name)" It shows the sum of total amount = 4720 which is wrong. : snap 2

 

Please help !

 

snap 1

 

snap 2

Hi Dennis Hudson,

 

It is working now ! when I removed all the esq.addColumn(); and using DB Name of the column in the filter and aggregate method.

 

Thanks 

Best 

Akshit.

Show all comments

Hello all,

Im working on a business process to send an email from in the document section, i want to include any attachment in the object to the email through the process. 

Any advise on which object i should pull the attachment from and whats the best way to do this is welcomed.

Thank you

Like 0

Like

1 comments

Hello,

 

You can use the object Document attachment to read attachments. The send element should be implemented in the business process using a script task element and creating a correct script for it. You can find an example of such task here: https://community.creatio.com/questions/add-orders-attachments-email

 

Best regards,

Angela

Show all comments

Hello all,

 

I am trying to use the show on map function from the contact section page and add it to the actions on the contact record page.

I have added the function to the page schema and added it to the actions menu. However, when I load the page, the button works and displays the map but it doesn't display the caption string on the button. 

Though oddly, when I reload the page, the string appears but the map then won't load.

 

What could be causing this?

Like 0

Like

3 comments

Hello Kevin,

 

Caption is not displayed since once the edit page is reviewed in combined mode then localizable values are being received from the section schema. To resolve this problem you need to:

 

1) Add the same localizable value to the ContactSectionV2 schema as on the ContactPageV2 schema

2) Add this part of code to the contact page schema:

 

define("ContactPageV2",["ContactPageV2Resources", "MapsHelper", "MapsUtilities"],

        function(resources, MapsHelper, MapsUtilities){

    return{

        entitySchemaName:"Contact",

        modules:/**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,

        messages: {

            "GetMapsConfig": {

                mode: Terrasoft.MessageMode.PTP,

                direction: Terrasoft.MessageDirectionType.SUBSCRIBE

            }

        },

        businessRules:/**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,

        methods:{

            getActions: function() {

                var actionMenuItems = this.callParent(arguments);

                actionMenuItems.addItem(this.getButtonMenuItem({

                    "Tag": "showOnMap",

                    "Click": {"bindTo": "openShowOnMap"},

                    "Caption": {"bindTo": "Resources.Strings.ShowOnMapCaption"},

                    "Visible": true

                }));

            

                return actionMenuItems;

            },

            showOnMap: function(schemaName, items, callback) {

                var config = config || {};

                items = items || this.getesqedItems();

                var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {

                    rootSchemaName: "ContactAddress"

                });

                esq.addColumn(schemaName + ".Name");

                esq.addColumn("AddressType");

                esq.addColumn("Address");

                esq.addColumn("City");

                esq.addColumn("Region");

                esq.addColumn("Country");

                if(config.columnNameLongitude){

                    esq.addColumn(config.columnNameLongitude);

                }

                if(config.columnNameLatitude){

                    esq.addColumn(config.columnNameLatitude);

                }

                esq.filters.addItem(this.Terrasoft.createColumnInFilterWithParameters(schemaName, items));

                esq.getEntityCollection(function(result) {

                    var addresses = result.collection;

                    if (result.success && !addresses.isEmpty()) {

                        var mapsData = [];

                        var mapsConfig = {

                            mapsData: mapsData

                        };

                        addresses.each(function(item) {

                            var addressType = item.get("AddressType").displayValue;

                            var address = MapsHelper.getFullAddress.call(item);

                            var content = this.Ext.String.format("<h2>{0}</h2><div>{1}</div>", addressType, address);

                            var dataItem = {

                                caption: addressType,

                                content: content,

                                address: address,

                                gpsE: item.get(config.columnNameLongitude),

                                gpsN: item.get(config.columnNameLatitude)

                            };

                            mapsData.push(dataItem);

                        }, this);

                        callback.call(this, mapsConfig);

                    } else {

                        this.showInformationDialog(resources.localizableStrings.EmptyAddressDetailMessage);

                    }

                }, this);

            },

            openShowOnMap: function() {

                var items = [];

                items.push(this.get("Id"));

                this.showOnMap.call(this, this.entitySchemaName, items, function(mapsConfig) {

                    MapsUtilities.open({

                        scope: this,

                        mapsConfig: mapsConfig

                    });

                });

            }

}

 

3) Add the EmptyAddressDetailMessage localizable string to the ContactPageV2 schema

 

Best regards,

Oscar

Dear Oscar,

I m trying to display the adresse on the map, but when i do the final step:

callback.call(this, mapsConfig);

i ve got the error:

message: Uncaught Error: Map container is already initialized.

 

Here's my code :

define("UsrNearestAccountsf7482dd9Page", ["MapsHelper", "MapsUtilities"], function(MapsHelper, MapsUtilities) {
	return {
		entitySchemaName: "UsrNearestAccounts",
		attributes: {},
        messages: {
            "GetMapsConfig": {
                mode: Terrasoft.MessageMode.PTP,
                direction: Terrasoft.MessageDirectionType.SUBSCRIBE
            }
        },
		modules: /**SCHEMA_MODULES*/{
			"Indicator7c02186a-07da-467a-90ed-cf5286772816": {
				"moduleId": "Indicator7c02186a-07da-467a-90ed-cf5286772816",
				"moduleName": "CardWidgetModule",
				"config": {
					"parameters": {
						"viewModelConfig": {
							"widgetKey": "Indicator7c02186a-07da-467a-90ed-cf5286772816",
							"recordId": "cb62f87b-52b6-4482-8283-344ec2f94e1a",
							"primaryColumnValue": {
								"getValueMethod": "getPrimaryColumnValue"
							}
						}
					}
				}
			},
			"Indicator32f96c54-6fbf-45be-b641-95268da60efc": {
				"moduleId": "Indicator32f96c54-6fbf-45be-b641-95268da60efc",
				"moduleName": "CardWidgetModule",
				"config": {
					"parameters": {
						"viewModelConfig": {
							"widgetKey": "Indicator32f96c54-6fbf-45be-b641-95268da60efc",
							"recordId": "cb62f87b-52b6-4482-8283-344ec2f94e1a",
							"primaryColumnValue": {
								"getValueMethod": "getPrimaryColumnValue"
							}
						}
					}
				}
			}
		}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
            getActions: function() {
                var actionMenuItems = this.callParent(arguments);
                actionMenuItems.addItem(this.getButtonMenuItem({
                    "Tag": "showOnMap",
                    "Click": {"bindTo": "openShowOnMap"},
                    "Caption": "openShowOnMap",
                    "Visible": true
                }));
 
                return actionMenuItems;
            },
            openShowOnMap: function() {
                var items = [];
                items.push(this.get("NearAccount"));
                this.showOnMap.call(this, "Account", items, function(mapsConfig) {
                    MapsUtilities.open({
                        scope: this,
                        mapsConfig: mapsConfig
                    });
                });
            },
 
            showOnMap: function(schemaName, items, callback) {
 
                var config = config || {};
                items = items || this.getesqedItems();
 
                var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
                    rootSchemaName: "AccountAddress"
                });
 
                esq.addColumn("AddressType");
                esq.addColumn("Address");
                esq.addColumn("City");
                esq.addColumn("Region");
                esq.addColumn("Country");
                esq.addColumn("GPSE");
                esq.addColumn("GPSN");
 
                esq.filters.addItem(this.Terrasoft.createColumnInFilterWithParameters(schemaName, items));
                esq.getEntityCollection(function(result) {
                    var addresses = result.collection;
                    if (result.success &amp;&amp; !addresses.isEmpty()) {
 
                        var mapsData = [];
                        var mapsConfig = {
                            mapsData: mapsData
                        };
 
                        addresses.each(function(item) {
                            this.console.log('item: '+this.print_r(item));
                            var addressType = item.get("AddressType").displayValue;
                            var gpsE = item.get("GPSE");
                            var gpsN = item.get("GPSN");
                            var address = MapsHelper.getFullAddress.call(item);
                            var content = this.Ext.String.format("&lt;h2&gt;{0}&lt;/h2&gt;&lt;div&gt;{1}&lt;/div&gt;", addressType, address);
                            var dataItem = {
                                caption: addressType,
                                content: content,
                                address: address,
                                gpsE: gpsE,
                                gpsN: gpsN
                            };
 
                            this.console.log('dataItem:'+this.print_r(dataItem));
                            mapsData.push(dataItem);
 
                        }, this);
 
                        this.console.log('mapsConfig:'+this.print_r(mapsConfig));
                        callback.call(this, mapsConfig);
 
                    } else {
                        this.showInformationDialog("EmptyAddressDetailMessage");
                    }
                }, this);
            }, 
             print_r: function(obj) { //debug
              let cache = [];
              let str = JSON.stringify(obj, function(key, value) {
                if (typeof value === "object" &amp;&amp; value !== null) {
                  if (cache.indexOf(value) !== -1) {
                    // Référence circulaire trouvée
                    return;
                  }
                  // enregistrement de la valeur dans la collection
                  cache.push(value);
                }
                return value;
              });
              cache = null; // reset
              return str;
            }          
        },
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "NearAccountaf54e816-a480-49e1-b827-362d9259418c",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 0,
						"layoutName": "Header"
					},
					"bindTo": "NearAccount"
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 0
			},
			{
				"operation": "insert",
				"name": "NearAddress0e195398-6b7e-4bed-81c7-4250803f37dd",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 1,
						"layoutName": "Header"
					},
					"bindTo": "NearAddress"
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 1
			},
			{
				"operation": "insert",
				"name": "Distanced9f7c441-62cf-4789-bad3-d9452054b13f",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 2,
						"layoutName": "Header"
					},
					"bindTo": "Distance"
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 2
			},
			{
				"operation": "merge",
				"name": "ChangesHistoryTab",
				"values": {
					"order": 0
				}
			},
			{
				"operation": "merge",
				"name": "MapTab",
				"values": {
					"order": 1
				}
			},
			{
				"operation": "merge",
				"name": "ESNTab",
				"values": {
					"order": 2
				}
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Here is the screenshot:

screenShot

 

I retrieve the address and coordinates correctly but I cannot display the marker on the map

 

Do you have an idea why i ve got this error ?

 

Thank you,

Nicolas

 

LÉZORAY Nicolas,

 

I change BaseModulePageWithMap to BaseModulePageV2 on my object page nad now it works !

 

thank you !

Show all comments

I created an Excel report on 5/4 and was able to successfully run in several times. However, it will not run now and gives the attached error message. I recreated the report and it is also giving me this error message. However, if I run one of the other excel reports I created it runs just fine. What could be the issue with this?

File attachments
Like 0

Like

9 comments
Best reply

Disregard - I solved it myself. The title of the file had "&". Once I removed the symbol it worked as expected. 

Hi Melinda,

 

please download the template of the report via the 'Download template' button and try it open without data. Come back with results. The issue relates to the xlsx file itself.

Irina Lazorenko,

Hello Irina, the template downloads just fine. When I select "Generate Report" with or without the template open I get the error message. 

 

Hi Melinda,

 

Kindly send the xlsx file without data so that we could investigate the template itself. Also, please specify what operating system (+ version) you are using on your PC.

Irina Lazorenko,

I am using Windows 7 Professional. Attached is the template. Thanks for your review. Melinda

 

Hi Melinda,

 

This is to inform you that we have successfully downloaded the template and forwarded it to the responsible team for a review. 

We'll get back with a reply as soon as we have their feedback.

 

P.S. Note that the template's been removed from the post.

 

Have a good forthcoming weekend! 

S.Kobizka,

Hello do you have an update on this?

 

Thank you for removing the template from the post. 

I just created a brand new report and again I am getting the .xlsx file extension error. This has been going on for almost a month now and I need to pull report asap. Please assist as this is now an urgent matter.

Disregard - I solved it myself. The title of the file had "&". Once I removed the symbol it worked as expected. 

Melinda Krupcyznski,

Hi Melinda,



Sorry for my belated reply and thank you for your post.

 

The point is that our responsible team's been trying to figure out the problem all this time. My colleagues checked and double-checked the template and it downloaded OK for them, so it was hard to detect the error.



We are very glad it is resolved for you now and highly appreciate your attention to detail.

 

Have a good day!

Show all comments

I've seen that when a case is automatically created upon receiving an email, the case "Source" field is "email".

I have several mailboxes used to create cases and I'd like to set different "source" values depending on the source mailbox (for example "email mailbox1", "email mailbox 2", ecc) to make statistics and better distinguish cases depending on the source mailbox that originated the case.

How can I configure the "source" field for a case depending on the mailbox that created it?

Like 0

Like

1 comments

Hello Massimiliano, 



As an option, you can use a Category field for this purpose. 

You can specify names of mailboxes in this field by editing "Case categories" lookup. 

Please follow this academy article to find information on how to create a connection between Case Category and Mailbox the case has been registered from. 



Kind regards,

Roman

 

Show all comments

Hello, I've created a custom section and notice when I add a new record and click save, the record automatically closes and takes the user back to the Section to view the list of records. Is there a setting that can be changed so when you save a new record, the page does NOT close and instead the user stays on the page?

Like 0

Like

2 comments

Hi Mitch,

You can find the answer on this thread: https://community.creatio.com/questions/stay-current-edit-page-after-saving-record

 

Regards,

Phuong Nguyen

Hello Mitch, 



Please take a look at the comment above from Phuong Akira. 

The answer on how to reach the functionality you have asked about is described there. 



Kind regards,

Roman

Show all comments

I have been having issues changing the default behavior when adding a record from a detail with an editable list. After adding the “IsEditable” attribute to my detail schema, whenever I want to add a record from the detail page a new row is added rather than showing the edit page for adding a new record. Is there a way I change this behavior?

Like 1

Like

2 comments
Best reply

Daer Alex, 

 

You can override the method openCardByMode in the detail schema, forcing the detail to open the card instead of adding a row. You can see the original method in the BaseGridDetailV2 schema in the NUI package. 

 

Daer Alex, 

 

You can override the method openCardByMode in the detail schema, forcing the detail to open the card instead of adding a row. You can see the original method in the BaseGridDetailV2 schema in the NUI package. 

 

Dennis Hudson,

 Thank you I was able to override this method and it worked. For anyone  trying to do a similar thing here is the code I added to my detail schema.

 

openCardByMode: function() {
     const cardState = this.get("CardState");
     const editPageUId = this.get("EditPageUId");
     const primaryValueUId = this.get("PrimaryValueUId");
     this.openCard(cardState, editPageUId, primaryValueUId);    
}

 

I just removed the if else statement from the original method:

 

if (this.getIsEditable() &amp;&amp; cardState !== enums.CardStateV2.EDIT) { 
    this.addRow(editPageUId);
} else {
    this.openCard(cardState, editPageUId, primaryValueUId);
}

 

Show all comments