Sales_Creatio_enterprise_edition
8.0

I'm using DataService's web service to create new records in a simple custom object (via {{BaseUri}}/0/DataService/json/SyncReply/InsertQuery). 

This object/section has a lookup to Contact, and so far in the body of the request I have been sending each Contact Id like this:

"ContactLkp": {
  "expressionType": 2,
  "parameter": {
    "dataValueType": 10,
    "value": "6530f9b7-2ca2-48a6-b529-fbfd456aa704"
  }
}

However, for this to work, it is a prerequisite to previously having searched each contact's Id vía SelectQuery.

 

My question is, could it be possible to insert the contact by using a subQuery? It seems like it should according to this documentation (by using an expressionType of value 3), but I have been unable to create a successful subQuery/subFilter. 

What I would like to do is something like this:

"ContactLkp": {
  "expressionType": 3,
  "subQuery": {
     // Use a select query by using a parameter like the name 
     // or the email of the contact
 
  }
}

With this I would be able to insert the record with only 1 request (insert) instead of 2 (select/search and then insert).

 

TL;DR, is it possible to include subqueries as parameters in DataService's InsertQuery?

Like 0

Like

2 comments
Best reply

Hello,

If I understand you correctly, you are trying to do something like this "INSERT INTO Contact (OwnerId) VALUES ((SELECT Id FROM Contact WHERE Name = 'Test1'))", select inside of the insert.

Unfortunately, currently, it is impossible to do so and you need to use two requests, first Select and second Insert as you did before.

Parameter SubQuety isn't designed for this situation and you write select requests inside of it.

{
                "ActivitiesCount",
                new SelectQueryColumn ()
                {
                    Expression = new ColumnExpression ()
                    {
                        // Expression - subquery.
                        ExpressionType = EntitySchemaQueryExpressionType.SubQuery,
                        // Path to the column relative to the root schema.
                        ColumnPath = "[Activity: Contact] .Id",
                        // Function type - aggregating.
                        FunctionType = FunctionType.Aggregation,
                        // Aggregation type - number.
                        AggregationType = AggregationType.Count
                    }
                }
            }

 

We already created a problem for our developers so that you can achieve your task using only one request, thank you for helping us improve the system.

 

Hello,

If I understand you correctly, you are trying to do something like this "INSERT INTO Contact (OwnerId) VALUES ((SELECT Id FROM Contact WHERE Name = 'Test1'))", select inside of the insert.

Unfortunately, currently, it is impossible to do so and you need to use two requests, first Select and second Insert as you did before.

Parameter SubQuety isn't designed for this situation and you write select requests inside of it.

{
                "ActivitiesCount",
                new SelectQueryColumn ()
                {
                    Expression = new ColumnExpression ()
                    {
                        // Expression - subquery.
                        ExpressionType = EntitySchemaQueryExpressionType.SubQuery,
                        // Path to the column relative to the root schema.
                        ColumnPath = "[Activity: Contact] .Id",
                        // Function type - aggregating.
                        FunctionType = FunctionType.Aggregation,
                        // Aggregation type - number.
                        AggregationType = AggregationType.Count
                    }
                }
            }

 

We already created a problem for our developers so that you can achieve your task using only one request, thank you for helping us improve the system.

 

Thank you for your kind reply. I will continue to do as suggested. 

Show all comments
Files
postman
Sales_Creatio_enterprise_edition
8.0

Hello community,

 

I have been reading a lot of threads to understand if we can stream files into file detail using postman.

 

According to 

https://community.creatio.com/questions/attachments-and-notes-using-dat…

Odata will not be a viable option



According to 

https://community.creatio.com/questions/fileapiservice-error

FileAPIService cannot be used to pass binary content via postman.



Are we right in understanding that to stream files via API, we need to create a custom service?



Thanks in advance!

Like 0

Like

5 comments

Hi,

You can use FileApiService/UploadFile.

You can find examples in this discussion.

Dmytro Vovchenko,

what is the 

FileApiService?

noyzada,

 

You can find information here.

Bogdan,

Hi,

I'm using the 8.06 version / application section and now all the files save to the SysFile table,

I manage to post a file with postman but I can't connect it to the right record where the details of the files are 

you know how can i do it with the new version? with sysfile table

Show all comments
Access Rights
premissions
Sales_Creatio_enterprise_edition
7.18

Hello, please help.

There are 2 objects, in both access rights on records are configured. In the 1st object there is a field "lookup of the 2nd object", it is necessary that - if a record from the 2nd object is selected in the record of the 1st object, then users from the second object are added to the record of the 1st object?

Like 0

Like

3 comments

Hello colleagues,

Yes, it's necessary to provide the user with access rights to both objects.

Otherwise, this column may be empty for the user.

Best regards, Alex. 

Aleksei Efimenko,

THank you for your answer, but I think we didn't get each other.

For instance , we have object 1- opportunity, and object 2 - product,  the product has relationship with opportunuty - 1:N, so there is a lookup field in opportunity for product.

The question is:

Can I configure user rights as when User 1 has access righs to particular product, it will has acess rights to opportunity also.

So if I have Opp_1 and related with him product_1 in that opportunity. If User 1 has access rights to product 1, I need him to have acess rights to its opporunity.

Gevorgyan Tigran,

Unfortunately, no, the user won't have rights to opportunities where certain products are assigned.

Best regards, Alex. 

Show all comments
Sales_Creatio_enterprise_edition
8.0

Hello, I am currently trying to create a combobox of the contacts associated with a certain account. When a contact is selected, then that contact will be made the primary contact.

 

Everything works fine, but when the edit page first launches the combobox does not display the primary contact and appears as it does below.

How would I get the combobox to display the primary contact on initialization like below.

Here is my replacing client schema:

define("AccountPageV2", [],function() {
    return {
        entitySchemaName: "Account",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        attributes: {
            "myEnum": {
                "dataValueType": Terrasoft.DataValueType.ENUM,
                "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                "caption": "Primary Contact:"
            },
            "myList": {
                "dataValueType": Terrasoft.DataValueType.ENUM,
                "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                "isCollection": true
            }
        },
        diff: /**SCHEMA_DIFF*/[
            {
                "operation": "insert",
                "name": "myEnum",
                "values": {
                    "caption": "myEnum",
                    "dataValueType": this.Terrasoft.DataValueType.ENUM,
                    "bindTo": "myEnum",
                    "layout": { "colSpan": 24, "rowSpan": 1, "column": 0, "row": 4 },
                    "controlConfig": {
                        "className": "Terrasoft.ComboBoxEdit",
                        "list": {
                            "bindTo": "myList"
                        },
                        "change": {
                            "bindTo": "onMyValueChange"
                        },
                        "prepareList": {
                            "bindTo": "prepareMyList"
                        }
                    }
                },
                "parentName": "SolutionTab_gridLayout",
                "propertyName": "items",
                "index": 1
            }
        ]/**SCHEMA_DIFF*/,
        methods: {
            onPageInitialized: function(callback, scope) {
                if (!this.get("myList")) {
                    this.set("myList", this.Ext.create("Terrasoft.Collection"));
                }
 
                if (callback) {
                    callback.call(scope || this);
                }
            },
            onEntityInitialized: function() {
                this.callParent(arguments);
            },
            prepareMyList: function(filter, list) {
				if (list === null) {
                    return;
                }
                list.clear();
				// create query for server side
				var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
					rootSchemaName: "Contact"
				});
				esq.addColumn("Name", "Name");
				esq.addColumn("Id", "Id");
				esq.addColumn("Account.Id","Account");
				esq.addColumn("Job.Name","Job");
				// run query
				var filterAccountType = esq.createColumnFilterWithParameter(
						Terrasoft.ComparisonType.EQUAL, "Account", this.get("Id"));
				esq.filters.addItem(filterAccountType);
				esq.getEntityCollection(function(result) {
					//perform
					if (!result.success) {
						/* For example, error processing/logging. */
						this.showInformationDialog("Data query error");
						return;
					}
					var count = 0;
					var items = {};
					result.collection.each(function (item) {
						items[item.get("Id")] = {
							"value": item.get("Id"),
							"displayValue": item.get("Name")+ "  :  " + item.get("Job")
						};
					});
					var list = this.get("myList");
					list.loadAll(items);
				}, this);
            },
            onMyValueChange: function(val) {
                if (val) {
                    console.log("New Primary Contact Added");
					this.set('PrimaryContact',val);
                }
            }
        },
        rules: {}
    };
});

 

Like 0

Like

4 comments
Best reply

Dominic Ricci,

Since the Comboxbox is bound to the myEnum attribute, you should be able to set the default as something like this: 

this.set("myEnum", { 
    value: "DefaultIdValue", 
    displayValue: "DefaultTextValue" 
});

Ryan

Hi,

Hard to tell the problem based on the code alone. In this case, you need to do a debug to find the cause.

Maybe this example may help you, the task of setting a default value is quite similar to your case.

Dmytro Vovchenko,

In the example you link there is the line of code



this.set("Deadline", newDate);

 

How would I do this for the combobox? Maybe something like this...

 

value = this.get("Primary Contact");

this.set("myEnum", value);



The issue is that I do not know how to access the initialized value in the combobox. Is the assumption of setting myEnum correct? 

Dominic Ricci,

Since the Comboxbox is bound to the myEnum attribute, you should be able to set the default as something like this: 

this.set("myEnum", { 
    value: "DefaultIdValue", 
    displayValue: "DefaultTextValue" 
});

Ryan

Ryan Farley,

This is what I was looking for. Thank you!

Show all comments
Access Rights
rights
dynamic folder
Sales_Creatio_enterprise_edition
7.18

Hi,

I want to set up access right to a folder on the project section but it is not showing me this option. When I click the setting Icon I only have Set up filter, Rename, Move Copy, Delete.

When I try in other sections like order and account I do have the Set up access right.

Like 0

Like

4 comments

You have to turn on Access rights by records in ProjectFolder object



Permissions on entries in the ProjectFolder object are enabled, but permissions settings are not. I guess I didn’t formulate the question very correctly, the permission settings for dynamic groups (folders) are not displayed

Gevorgyan Tigran,

Hi Gevorgyan,

the same thing happens with Event section

If you re-login to creation everything works finr

Show all comments
Sales_Creatio_enterprise_edition
8.0

Hi all, 



I'm just starting to get to grips with making API calls to Creatio and stuck trying to POST a new record, where a column is a lookup. 



I understand that I can post using the Guid to the lookup using column name "UsrLookupNameId". However, if I don't have the Id but only a value in one of the Lookups column, is that possible? 

 

For example, I have the lookup UsrNationality, but I only have the value "Germany" and not the ID. Or, must I first make a GET request to get the ID? 

 

Here is current code: 

 

{

"UsrName": "Test Name",

"UsrNationality": "Germany"

}

 

Any help much appreciated :)

Like 0

Like

2 comments

Hi Harry,

You would have to first do a GET to the lookup object to get the record where the Name = "The name", then do the POST separately using the Id value for the lookup column. So two separate calls, one to GET the lookup and a second to POST the new record.

Typically when I have code working with Creatio's API's I retrieve the needed lookups into a local cache to avoid repeatedly doing GETs to the lookups.

Ryan

Thanks Ryan, that's what I thought. I used the "GET

$filter parameter (eq operator)" option in the end. 



I'm integrating using Make.com, so little harder to leave everything in local cache. Have got it working well now though. 

 

Thanks again for the reply.

Show all comments
callback
multiplecallback
Sales_Creatio_enterprise_edition
7.18

Hello,

 

I need to make a button visible based on a few conditions

1. If current user contact record has a lookup value of "Approver"

and

2. If account record of the current user contact has lookup value "Enterprise"

 

Since there are 2 tables to be queried, I understand I need to use callbacks and chaining. This does not seem to work well for me. I have also tried passing a callback function within a callback function, but still its not working well. Can someone please give an example of multiple callbacks?

 

Thanks

Like 1

Like

2 comments

There's no need for the multiple callbacks since this can be done in a single ESQ query. For example, the ESQ below retrieves both the current user's Type value as well as the current user's account Type value in the same call.

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "Contact"
});
 
esq.addColumn("Type");
esq.addColumn("Account.Type", "AccountType");
 
esq.getEntity(Terrasoft.SysValue.CURRENT_USER_CONTACT.value, function (result) {
    if (result.success) {
        var conType = result.entity.values.Type,
            accType = result.entity.values.AccountType;
 
        if ((conType && conType.displayValue == "Approver")
            && (accType && accType.displayValue == "Enterprise")) {
            // do something
        }
    }
}, this);

However, to nest a ESQ in a callback of another ESQ it would look like this: 

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
	rootSchemaName: "Contact"
});
 
esq.addColumn("Type");
esq.addColumn("Account");
 
esq.getEntity(Terrasoft.SysValue.CURRENT_USER_CONTACT.value, function (result) {
    if (result.success) {
        var conType = result.entity.values.Type,
            account = result.entity.values.Account;
        if (conType && conType.displayValue == "Approver") {
            var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                rootSchemaName: "Account"
            });
 
            esq.addColumn("Type");
 
            esq.getEntity(account.value, function (result) {
                if (result.success) {
                    var accType = result.entity.values.Type;
                    if (accType && accType.displayValue == "Enterprise") {
                        // do something
                    }
                }
            }, this);
        }
    }
}, this);

Ryan

Show all comments
Javascript
Sales_Creatio_enterprise_edition
7.18

Hi Community!

 

I have the following requirement:

We need to link a custom entity called reclamations to the activity. This has to be done m:n. So I have created a new link entity called ReclamationInActivity and added it as a detail to the ActivityPageV2.js.

 

When adding such a ReclamationInActivity record from the activity a new page opens and the user can open the reclamation lookup window there to select or create a reclamation.

When they choose to create a new reclamation, the account and contact have to be prefilled on the "new reclamation" page.

 

I cannot use business rules, because there is no link from the reclamation to ReclamationInActivity.

Also, using a business process is not an option, because the user would have to save the record first and we need to prefill the values.

Is there a way to achieve this by javascript somehow?

 

Thanks,

Robert

Like 0

Like

1 comments

Hi,

If I understand you correctly you want to add a value to columns "Contact" and "Account" from your activity. If so, you can use a simple esq request to get these values and set them in the init or onEntityInitialized methods.

Show all comments
image
containers
CSS
Sales_Creatio_enterprise_edition
7.18

Hello,

 

We have a boolean column in accounts section. If the value is checked, we would like to add an image on the header space as highlighted in yellow in image below. Is there a sample code/ recommendation for this?

 

Like 0

Like

1 comments

Hello,

You can write a simple button and display it in the center. 

{
				"operation": "insert",
				"name": "TestContainer",
				"parentName": "ActionButtonsContainer",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.CONTAINER,
					"wrapClass": ["test-container-wrapClass"],
					"items": []
				}
			},
            {
                "operation": "insert",
                "parentName": "TestContainer",
                "propertyName": "items",
                "name": "PrimaryContactButton",
                "values": {
 
                    "itemType": Terrasoft.ViewItemType.BUTTON,
                    "click": {bindTo: "testclick"},
					"visible": {bindTo: "checkVisible"},
                    "enabled": true,
                    "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
					"imageConfig": {"bindTo": "Resources.Images.EnrichedDefaultIcon"}
                }
            }

In the method checkVisible you can return true or false based on the condition.

To make it at the center just add a new CSS style:

define("AccountPageV2", ["css!UsrDStyle"], function() {

 

.test-container-wrapClass {

        margin-left: auto;

    margin-right: auto;

    width: 6em

    }

 

Show all comments
Sales_Creatio_enterprise_edition
8.0

Hi Creatio Team,



The requirement is to show only the needed columns/attributes to be displayed in the OOTB filter in the section as you can see in the below image.





As you can see in the above image, all the columns are getting displayed in the contact section. The requirement is too show the needed columns/attributes and not the whole. Need to implement this functionality across sections. Kindly, guide us in implementing the functionality.



Regards & Thanks,

Adharsh S

Like 0

Like

3 comments

Hi,

Take a look at this post, you can hide unnecessary columns by setting its Usage mode to "None".

Also, you can look here:

https://community.creatio.com/questions/hide-fields-lookup-filter

Dmytro Vovchenko,



We can't use the Usage Mode - None. because these fields which are to be hidden, need to be reused in Business Rules, process and other places. So, this approach we can't go forward.



The second approach, I have looked into the link - 

https://community.creatio.com/questions/hide-fields-lookup-filter.



The below code mentioned in the above link,

define("GlbLookupPage", ["ConfigurationEnums", "LookupPage"], function(ConfigurationEnums) {
 
    Ext.define("Terrasoft.configuration.GlbLookupPage", {
        override: "Terrasoft.LookupPage",
        alternateClassName: "Terrasoft.GlbLookupPage",
 
 
generateViewModel: function() {
            var model = this.callParent(arguments);
            model.getSchemaColumns = this._getSchemaColumns;
            return model;
        }

Can you give me some example code - For eg, I need to filter only the columns such as ("Account", "Full Name", "Age", "Address type") under contact Section.

 

Regards,

Adharsh S

 

Hi Creatio Team,



Can you help me out with the mentioned scenario ?



Test case - "Can you give me some example code - For eg, I need to filter only the columns such as ("Account", "Full Name", "Age", "Address type") under contact Section."



Regards,

Adharsh S

Show all comments