Hi everyone,

do someone have an example of the DataSourceLoadOptions that can be used to "set up pagination and sorting"?
As explained at this link: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/front-end-development/freedom-ui/data-sources/crud-operations/references/model-class-js



Thanks.

BR,
Samuel

Like 2

Like

3 comments
Best reply

Hello,

 

Here is a handler that will trigger calling the model load with the sorting using the "Name" column from the "Account" entity in the ascending order with row offset 15 and 1 record fetch:

{
				"request": "usr.TriggerCustomRequest",
				handler: async (request, next) => {
					const accountModel = await sdk.Model.create("Account");
					const accounts = await accountModel.load({
							attributes: ['Id', 'Name'],
							options: {
								pagingConfig: {
									rowsOffset: 15,
									rowCount: 1
								},
								sortingConfig: {
									columns: [
										{
											columnName: "Name",
											direction: "asc"
										}
									]
								}
							}
						});
					return next?.handle(request);
				},
			}

Hello,

 

Here is a handler that will trigger calling the model load with the sorting using the "Name" column from the "Account" entity in the ascending order with row offset 15 and 1 record fetch:

{
				"request": "usr.TriggerCustomRequest",
				handler: async (request, next) => {
					const accountModel = await sdk.Model.create("Account");
					const accounts = await accountModel.load({
							attributes: ['Id', 'Name'],
							options: {
								pagingConfig: {
									rowsOffset: 15,
									rowCount: 1
								},
								sortingConfig: {
									columns: [
										{
											columnName: "Name",
											direction: "asc"
										}
									]
								}
							}
						});
					return next?.handle(request);
				},
			}

Hi Oleg, is there a way to retrieve distinct values modifying the "options"? How can I do it?

Luca Tavasanis,

Unfortunately, there is no way to apply distinct using the SDK model. 

We've registered the idea to our R&D team and hope to see the realization in the nearest releases. Thank you for making us better!

Show all comments

Hi All,

I have two instances of Creatio and they are both fail to compile.

 

Old Instance 

New Instance 

I do have the c:\windows\system32\inetsrv\NuGet\Migrations folder created.  

 

Both logs show a variegation of the below error messages, 6 in the old and 12 in the new one.

 

2024-05-29 15:36:07,813 [99] INFO IIS APPPOOL\Studio_Assignment Build CaptureOutput - C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error :   No such host is known. (api.nuget.org:443) [C:\Creatio\Studio_Softkey_MSSQL_assinment\Terrasoft.WebApp\Terrasoft.Configuration\Terrasoft.Configuration.ODataEntities.csproj]
2024-05-29 15:36:07,813 [99] INFO IIS APPPOOL\Studio_Assignment Build CaptureOutput - C:\Program Files\dotnet\sdk\8.0.100\NuGet.targets(156,5): error :   No such host is known. [C:\Creatio\Studio_Softkey_MSSQL_assinment\Terrasoft.WebApp\Terrasoft.Configuration\Terrasoft.Configuration.ODataEntities.csproj]

 

I installed sdk\8.0.100 but the problem persists.

 

While looking at the documentation i see that sdk\8.0.100 is not a requirment so I'm a bit confused as to why the logs show this error message. 

 

The old version worked up until yesterday, not sure what changed.

Any help is much appreciated,

Thanks,

Paddy 

 

 

File attachments
Like 1

Like

2 comments
Best reply

It’s working now (the next day), both compile. 

 

My network was filtering some Microsoft traffic, after I removed the network restriction it worked as expected. 

It’s working now (the next day), both compile. 

 

My network was filtering some Microsoft traffic, after I removed the network restriction it worked as expected. 

Hello,
 

We are glad to hear that you managed to solve the compilation issues.

Based on the errors, the dotnet components lacked the necessary files for the application to work correctly and an attempt was made to get the necessary files from the NuGet repository, but since there was no full access to the repository via the Internet, this error occurred.

Show all comments

Hi everyone! We have released a new version of Clio and Clio Explorer.

What's new:

  1. .NET 6 is supported and Clio is now compatible with iOS on M series processors.

  2. OAuth settings are supported in the UI for easy connection with the Creatio trial version.

  3. Quick access to all Clio settings in Clio Explorer for advanced users.

  4. Support for working with auto-generated code in the package assembly for local development in workplaces.

3 comments

Links on Clio explorer and clio

You might want to reclassify as "Article" :)

Clio explorer seems awsome. Kudos to the team

Show all comments

Has anyone been successful using the CreatioSDK in sending date updates via either InsertQuery or UpdateQuery?

 

I've tried sending dates in all the following formats but all result in an error:

 

yyyy-MM-dd

yyyy-MM-ddTHH:mm:ss

yyyy-MM-ddTHH:mm:ss.fff 

yyyy-MM-ddTHH:mm:ss.fffffffZ

M/d/yyyy

d/M/yyyy

dd/MM/yyyy

 

The dates I'm trying to send are defined as DataValueType.Date and I've tried specifying that in the Update/InsertQuery and in desperation also tried specifying as DataValueType.DateTime. 

 

If I omit dates from the Insert/Update queries the updates are successful. 

 

I can successfully enter dates in the records I'm trying to update via the Creatio UI.

 

Here's an example of a stripped down InsertQuery request, including the DueDate column causes an error 500, if excluded the insert is successful:

 

{

  "QueryId": null,

  "QueryKind": 0,

  "ColumnValues": {

    "Items": {

      "Title": {

        "ExpressionType": 2,

        "IsBlock": false,

        "ColumnPath": null,

        "Parameter": {

          "DataValueType": 1,

          "Value": "Test SDK Three",

          "ArrayValue": null,

          "ShouldSkipConvertion": false

        },

        "FunctionType": 0,

        "MacrosType": 0,

        "FunctionArgument": null,

        "FunctionArguments": null,

        "DateDiffInterval": 0,

        "DatePartType": 0,

        "AggregationType": 0,

        "AggregationEvalType": 0,

        "SubFilters": null,

        "ArithmeticOperation": 0,

        "LeftArithmeticOperand": null,

        "RightArithmeticOperand": null

      },

      "Contact": {

        "ExpressionType": 2,

        "IsBlock": false,

        "ColumnPath": null,

        "Parameter": {

          "DataValueType": 0,

          "Value": "fede06a3-1270-4464-8049-c7afb144a018",

          "ArrayValue": null,

          "ShouldSkipConvertion": false

        },

        "FunctionType": 0,

        "MacrosType": 0,

        "FunctionArgument": null,

        "FunctionArguments": null,

        "DateDiffInterval": 0,

        "DatePartType": 0,

        "AggregationType": 0,

        "AggregationEvalType": 0,

        "SubFilters": null,

        "ArithmeticOperation": 0,

        "LeftArithmeticOperand": null,

        "RightArithmeticOperand": null

      },

      "DueDate": {

        "ExpressionType": 2,

        "IsBlock": false,

        "ColumnPath": null,

        "Parameter": {

          "DataValueType": 8,

          "Value": "2022-05-28",

          "ArrayValue": null,

          "ShouldSkipConvertion": false

        },

        "FunctionType": 0,

        "MacrosType": 0,

        "FunctionArgument": null,

        "FunctionArguments": null,

        "DateDiffInterval": 0,

        "DatePartType": 0,

        "AggregationType": 0,

        "AggregationEvalType": 0,

        "SubFilters": null,

        "ArithmeticOperation": 0,

        "LeftArithmeticOperand": null,

        "RightArithmeticOperand": null

      },

      "Amount": {

        "ExpressionType": 2,

        "IsBlock": false,

        "ColumnPath": null,

        "Parameter": {

          "DataValueType": 5,

          "Value": 6718.35,

          "ArrayValue": null,

          "ShouldSkipConvertion": false

        },

        "FunctionType": 0,

        "MacrosType": 0,

        "FunctionArgument": null,

        "FunctionArguments": null,

        "DateDiffInterval": 0,

        "DatePartType": 0,

        "AggregationType": 0,

        "AggregationEvalType": 0,

        "SubFilters": null,

        "ArithmeticOperation": 0,

        "LeftArithmeticOperand": null,

        "RightArithmeticOperand": null

      },

      "Budget": {

        "ExpressionType": 2,

        "IsBlock": false,

        "ColumnPath": null,

        "Parameter": {

          "DataValueType": 5,

          "Value": 0.0,

          "ArrayValue": null,

          "ShouldSkipConvertion": false

        },

        "FunctionType": 0,

        "MacrosType": 0,

        "FunctionArgument": null,

        "FunctionArguments": null,

        "DateDiffInterval": 0,

        "DatePartType": 0,

        "AggregationType": 0,

        "AggregationEvalType": 0,

        "SubFilters": null,

        "ArithmeticOperation": 0,

        "LeftArithmeticOperand": null,

        "RightArithmeticOperand": null

      }

    }

  },

  "RootSchemaName": "Opportunity",

  "IncludeProcessExecutionData": false

}

 

  

Like 0

Like

1 comments
Best reply

Hello Jerry, 



Please try to pass Date into Creatio with the following format in UTC time:

 

      "dataValueType":8,
      "value":"\"2000-01-01T00:00:00.000\""

Kind regards,
Roman

Hello Jerry, 



Please try to pass Date into Creatio with the following format in UTC time:

 

      "dataValueType":8,
      "value":"\"2000-01-01T00:00:00.000\""

Kind regards,
Roman
Show all comments

Question

When I paste a RICH_TEXT element, its toolbar looks as follows:

Could you clarify what might be wrong with it?

Answer

The reason might be that some of the base styles  in your configuration might be overridden, e.g., the .t-btn-image style.

Like 0

Like

Share

0 comments
Show all comments

Case

We need to create users of an "Our company" type for the employees of any company, and not only for those belonging to the "Our company" that exists out-of-the-box.

Solution

Change the PrepareEmployeeEditFilter method in the UserEditPage  schema as follows:

var filters = e.Filters;
filters.Add(new Dictionary<string, object> {
    {"comparisonType", FilterComparisonType.Equal},
    {"leftExpressionColumnPath", "[SysAdminUnit:Contact].Id"},
    {"aggregationType", AggregationTypeStrict.Count},
    {"useDisplayValue", false},
    {"rightExpressionParameterValues", new object[] {0}}});
filters.Add(new Dictionary<string, object> {
    {"comparisonType", FilterComparisonType.Equal},
    {"leftExpressionColumnPath", "Account.Type"},
    {"useDisplayValue", false},
    {"rightExpressionParameterValues", new object[] { new Guid("57412fad-53e6-df11-971b-001d60e938c6")}}});
e.ParametersValue.Add("hideButtons", true);

where "57412fad-53e6-df11-971b-001d60e938c6" is the ID of the AccountType table that corresponds to the "Our company" value.

Necessary conditions

For version 7.4 only

Like 0

Like

Share

0 comments
Show all comments

Question

When creating a case through the portal, the user sets the case Assignee using a code. Though, the [Assignee] field remains blank after saving the record.

Answer

When you save a Case object (the Portal package), you basically run the event sub-process defined in the CaseInserting event of the object. If you meet the UserType = SSP condition in this process,  the [Assignee] field is cleared.

Like 1

Like

Share

0 comments
Show all comments

Case

I need to create a widget

Solution

You can use widgets to display data from in-built modules. It enables displaying data in non-standard views.

Example of implementing a widget:

define('SxClientUnitTable', ['ext-base', 'terrasoft', 'sandbox', "BaseFiltersGenerateModule", 'SxClientUnitTableResources', "ChartModuleHelper", "css!SxClientUnitTableCss", "ServiceHelper"],
	function(Ext, Terrasoft, sandbox, BaseFiltersGenerateModule, resources, ChartModuleHelper, css, ServiceHelper, ConfigurationConstants) {
 
		function getViewModel() {
					return Ext.create('Terrasoft.BaseViewModel', {
				//todo SysModuleAnalyticsChart deleted
						entitySchema: 'Order',
						methods: {
							getChart: function(key) {
							debugger
								sandbox.publish('GenerateChart', key);
								var filters = this.getReportFilters();
							},
							load: function() {
 
							}
						}
					});
				};
		var result = "";
		function generateMainView(renderTo) {
 
			var resultConfig = Ext.create('Terrasoft.Container', {
				id: 'tableOtchetMetkiParamContainer',
				selectors: {
					wrapEl: '#tableOtchetMetkiParamContainer'
				},
				renderTo: renderTo
			});
			return resultConfig;
		}
		function getInfoMetki(parameters) {
 
			var serviceData = {
				site: parameters[0].toString(),
				ownerId: parameters[1].toString(),
				startDate: parameters[2].toString(),
				dueDate: parameters[3].toString(),
				countryId: parameters[4].toString()
			};
 
			ServiceHelper.callService("UsrOtchetMetkiGetCollectionConfigurationService", "GetCollectionOtchetMetki",
				function (response) {
				debugger
					if (response.status == 404) {
						this.showInformationDialog("\t Error: \n" + response.message);
					}
					else if(response.GetCollectionOtchetMetkiResult.length > 0){
						result = response.GetCollectionOtchetMetkiResult;
						var arrR = result.split(":");
						var htmlAdded = "<table><tr><th>Mark</th><th>Number of orders</th><th>Being specified</th><th>% Specified.</th><th>Confirmed</th><th>% Conf.</th><th>Completed</th><th>% Compl.</th><th>Canceled</th><th>% Canc.</th></tr>";
						for(var i = 0; i < arrR.length - 1; i++){
							//get items
							var strArr = arrR[i].split(" ");
							var metkaOne = strArr[0].replace("{","");
							var metka = metkaOne.replace("}","");
 
							htmlAdded += "<tr><td>" + metka + "</td><td>" + strArr[1].toString() + "</td><td>"  + strArr[2].toString() + "</td><td>" + strArr[3].toString() + "</td><td>" + strArr[4].toString() + "</td><td>" + strArr[5].toString() + "</td><td>" + strArr[6].toString() + "</td><td>" + strArr[7].toString() + "</td><td>"  + strArr[8].toString() + "</td><td>" + strArr[9].toString() + "</td></tr>";
						}
						//end table
						htmlAdded += "</table>";
						var el = Ext.get('tableOtchetMetkiParamContainer').setHTML(htmlAdded);
						var elemV = Ext.get('Module1');
						elemV.toggleCls('my-table');
					}
					else
						result = null;
				}, serviceData, this);
		}
		function getReplaceString(str, separator){
		debugger
		var arSt = str.split(separator);
			var res = arSt[2] + separator + arSt[1] + separator + arSt[0];
			while(res.indexOf(separator) > 0){
				res = res.replace(separator,"-");
			}
			return res;
		}
 
		var render = function(renderTo) {
 
 
			debugger
			var viewConfig = generateMainView(renderTo);
			var viewModel = getViewModel();
			var getStartD = Ext.get("fixedFilterDateView-wrap").dom.innerText;
			var getEndD = Ext.get("fixedFilterDateDueView-wrap").dom.innerText;
 
			var startD = getStartD.indexOf("Начало") > 0 ? "2016-05-01" : getReplaceString(getStartD, ".");
			var endD = getEndD.indexOf("Завершение") > 0 ? "2016-07-04" : getReplaceString(getEndD, ".");
			var ar = [];
			ar.push("all");
			ar.push("all");
			ar.push(startD);
			ar.push(endD);
			ar.push("a570b005-e8bb-df11-b00f-001d60e938c6");
			getInfoMetki(ar);
 
 
			viewConfig.bind(viewModel);
			//viewConfig.render(renderTo);
		};
		return {
			schema: 'Order',
			methods: {
				onLookupChange: function(newValue, columnName) {
 
                                this.callParent(arguments);
                                if (columnName === "UsrCityFilter") {
                                        this.set("UsrCityFilter", newValue);
                                        this.onUsrCityFilterChanged();
                                }
                        },
 
                        onUsrCityFilterChanged: function() {
                                this.reloadGridData();
                        },
				getOrdersForFilter: function(){
					var items = [];
					var selOrders = Ext.create("Terrasoft.EntitySchemaQuery", {
						rootSchemaName: "Order"
					});
					selOrders.addColumn("SxMark.Name");
					selOrders.addColumn("SxCountry.Name");
					var filterByUser = Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SxCountry.Name", "Россия");
					selOrders.filters.addItem(filterByUser);
					selOrders.getEntityCollection(function (response) {
					debugger
						if (response.collection.collection.length > 0)
							items = result.collection.getItems();
						else
							items = null;
					}, this);
					return items;
				}
 
			},
			userCode: function() {
 
			},
			init: function() {
 
			},
			filterChanged: function( filter, eOpts ){
				debugger
				var c = [];
			},
			render: render
		};
	}
)
;

 

 

Like 0

Like

Share

0 comments
Show all comments

Case

Access to section disappeared for all users, except for the Supervisor. Standard script for granting access permissions works but does not add records.

Solution

The [CreatedById] field in the user's database table is not populated. To solve the issue, populate the field and specify "Supervisor" as a creator:

Update Account --change the object
SET CreatedById = (SELECT id FROM Contact c WHERE c.Name = 'Supervisor')
where CreatedById is null;

 

Like 0

Like

Share

0 comments
Show all comments

Question

We cannot add contacts. The page freezes when doing so.

Answer

The details "Detail: Contact address" and "Detail: Contact communication options" have been deleted from the contact page. That is the reason why you cannot add new contacts.

Restore the details and you will receive no errors.

To do this, add the below code to the ContactPageV2 schema:

details: {
    "AccountAddress": {
        "schemaName": "AccountAddressDetailV2",
        "entitySchemaName": "AccountAddress",
        "filter": {
            "detailColumn": "Account",
            "masterColumn": "Account"
        },
        "useRelationship": true,
        "filterMethod": "accountAddressFilter"
    },
    "AccountCommunication": {
        "schemaName": "AccountCommunicationDetail",
        "entitySchemaName": "AccountCommunication",
        "filter": {
            "detailColumn": "Account",
            "masterColumn": "Account"
        },
        "useRelationship": true,
        "filterMethod": "accountAddressFilter"
    }
},
/**......*/
methods: {
    accountAddressFilter: function() {
        var account =  this.get("Account");
        var accountId = this.Terrasoft.GUID_EMPTY;
        if (account && account.value) {
            accountId = account.value;
        }
 
        var filterGroup = new this.Terrasoft.createFilterGroup();
        filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
        filterGroup.add("AccountFilter", this.Terrasoft.createColumnFilterWithParameter(
        this.Terrasoft.ComparisonType.EQUAL, "Account", accountId));
        return filterGroup;
    }
},
/**......*/

 

Like 0

Like

Share

0 comments
Show all comments