Hi,

I read collection of records using this script:

var entities = Get>("ReadDataUserTask2.ResultCompositeObjectList");

I want to loop through this list and set parameter with type contact to each object of the list.

The collection of records is a list of opportunityContact.

I tried converting each ICompositeObject to opportunityContact using this script:

foreach (var entity in entities)

{

 ...

    OpportunityContact contactInOpp = (OpportunityContact)entity;

    Set("contact",contactInOpp.Contact);

but OpportunityContact is not a known object.

How do I access the types of the tables (no need to add data to DB or search just get the type in order to convert)?

Thanks,

Chani

 

Like 0

Like

2 comments

Hi Chani,

 

Here is a working example of two cases: set the string parameter value from the process that reads the collection and also modify contacts massively in the script task based on the received collection.

 

Here is the screenshot of the main process:

and the screenshot of the sub-process:

The idea of the sub-process is to read the collection of 4 records and their emails, Ids and Names if to be more specific. Then the read values are passed to the main process as a collection and go to the main process parameters (see that the "OutputParameters" parameter has the value of "[#SubProcess that will read all the needed data from Contacts 1.OutputRecordCollection#]").

 

The script task itself calls the ProcessContactNames method that is specified in the main process "Methods" tab:

The listing of the code is below:

public void ProcessContactNames() {
	string result = "";
	var contactsList = Get<ICompositeObjectList<ICompositeObject>>("OutputParameters");
	foreach (ICompositeObject item in contactsList) {
				item.TryGetValue<string>("FullNameParameter", out string ContactName);
				item.TryGetValue<string>("EmailParameter", out string ContactEmail);
				item.TryGetValue<Guid>("IdParameter", out Guid ContactId);
				result = result + " " + ContactName + " " + ContactEmail + ", ";
				ContactName = "Oscar Dylan from process";
					var contactSchema = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");
					var entity = contactSchema.CreateEntity(UserConnection);
						entity.FetchFromDB("Id", ContactId);
						entity.SetColumnValue("Name", ContactName);
						entity.Save();
			}
Set<string>("StringParameter", result);
}

Also add the following usings to your main process:

System.Data
System.Security
Terrasoft.Configuration

The idea here is to pass the collection of records from the "OutputParameters" main process parameter, process each record in the foreach cycle, compose the result string that then will be displayed on the autogenerated page to check if the process worked and also find each contact by its Id that was passed from the collection and set the name column value for each contact as "Oscar Dylan from process".

 

As a result the process worked perfectly:

and contact names were modified:

Please analyze the process and use the same approach on your side.

 

Best regards,

Oscar

Oscar Dylan,

Thank you. 

Will try that.

Show all comments

Creatio by default allows a user to choose between 50, 250 and 500 as max lengths of a Text column from the Object designer. In a use case where Creatio co-exists with an external system and both share the same fields, it becomes important to maintain consistency with respect to data types and lengths.



Right now, the only way to enforce a custom length (say String(8)) is to implement field validators on the Creatio GUI and write custom code to validate any input received via server side integrations. However, the field in the DB would still have 50, 250 or 500 as the length. This is not ideal. 

 

It would be very useful to permit defining custom lengths of fields Eg String(8) from the Object designer which directly creates those custom lengths in the database. 

1 comments

Hello Shrikanth,

 

Hope you're doing well.

 

Thank you for being interested in the Creatio application and further its improvements. We have created a functional request and passed it to our R&D team. After additional review, if the request will be in high demand this kind of functionality will be implemented in the future versions of the application and the users will be able to permit defining custom lengths of the needed fields without adding the custom code.

 

We appreciate your cooperation!

 

Best regards,

Roman

Show all comments

I created a process which will give access to a particular portal user permission to read and edit record. The portal user name is filled in the record page. 

Process first triggers when a record is added then it read the portal user name in the record and assigns the access permissions. But the process is not giving access rights to the portal user. 

Can any one help ?

Here are the screen shots : -

1. Process

2. After adding record and process completion, the access rights 

3. Object permission of the Section page

Like 0

Like

5 comments

Hello Ramnath,

 

Could you please provide us with screenshots of the business process elements settings for further assistance on this matter?

 

Thank you in advance! Looking forward to your reply. 

Olga. 

Olga Avis,

Here are the screenshots of elements:-

1. Trigger element - record added

2. Read portal user name (Field name - Borrower)

3. The access rights added

The Role is the name of borrower which was read in 2nd Read Borrower element.

This process is in my local dev environment. I have also created the same process on a trial cloud environment. But the process does not seem to work. 

Is there anything I am missing?

Hello,

 

It is necessary to grant the rights not to User role but for the Employee  where you should indicate the value of the Borrower field http://prntscr.com/stoezu .  It should be something like this [#Read Borrower.First item of resulting collection.Borrower#]

As for now you try to grant the rights to some role and the system cannot identify it.

 

Best regards,

Dean

Dean Parrett,

 

I assigned the access role in process for employee. And the process works now.

But why can't we do for User role.

Even if it works with employee role. The borrower is not an employee. He/She is an end user who will fill the form. Why does it have to be assigned in Employee role.

Can you please elaborate?

 

Thanks

Ramnath

Hello,

 

The thing is that your process doesn't read the user role. It would be necessary to find the user's role first using additional read data elements and based on which role is found by, use it in Role parameter instead of Employee.



Regards,

Dean 

Show all comments



Hi there,

Can someone please let me where in the CRM are all the attachments stored in the database?

So say if I attach a file in the Attachment and Notes tab in the Contacts section, I know that the Attachments detail is called Contact's Detail but which object holds those attachments in the database?

Thanks,

AK

Like 0

Like

8 comments

Hello,

All files are stored as binary data in the "data" column of the object. Each one is stored in their own column, for example 'ActivityFile'

Best regards,

Angela

Angela Reyes,

 

Is it possible to copy the attachments from one object to another by copying the binary data from "data" column of the object.

 

Regards

Sivanesan

Hi,

If the field "Data" contains a correct value and not something like "0x" then yes, you can take this data and add it to another object.

For example, you can do it inside a business process script task.

 

var fileName = file.GetTypedColumnValue<string>("Name");
            var fileType = file.GetTypedColumnValue<Guid>("TypeId");
            var fileData = file.GetBytesValue("Data");
 
            var fileEntity = new ActivityFile(userConnection);
            fileEntity.SetDefColumnValues();
            fileEntity.SetColumnValue("ActivityId", activity.Id);
            fileEntity.SetColumnValue("TypeId", fileType);
            fileEntity.SetColumnValue("Name", fileName);
            fileEntity.SetColumnValue("Data", fileData);
            fileEntity.Save();

 

Dmytro Vovchenko,

 

Thanks for the response Dmytro. I am trying to copy the attachments from section A to section B. I have used "Add Data" element inside a BP to copy the data from A to B. The BP runs without any issue but when I try to open the same attachment from section B its throwing below error.

When I queried the object the attachments(both the sections) , it just shows the data type(System.Byte[]).

 

Can you please show how exactly you copy data in your bp?

Dmytro Vovchenko,

PFB

 

 

It looks like you cannot use "Add record" and "Read record" in this case because they cannot work with the "Data" type. You really need to use a script-task to read and add file:

        var ESQ = new EntitySchemaQuery(manager, AccountFile);
	    ESQ .AddColumn("Name");
	    ESQ .AddColumn("Data");
	    ESQ .AddColumn("Type");
 
	    var dataQueryResult = ESQ.GetEntityCollection(userConnection);
	    foreach(Entity file in dataQueryResult) {
		    var fileName = file.GetTypedColumnValue<string>("Name");
		    var fileType = file.GetTypedColumnValue<Guid>("TypeId");
		    var fileData = file.GetBytesValue("Data");
 
			var fileEntity = new ContactFile(userConnection);
		    fileEntity.SetDefColumnValues();
		    fileEntity.SetColumnValue("CintactId", contact.Id);
		    fileEntity.SetColumnValue("TypeId", fileType);
		    fileEntity.SetColumnValue("Name", fileName);
		    fileEntity.SetColumnValue("Data", fileData);
		    fileEntity.Save();
	    }

 

Dmytro Vovchenko,

 

I was able achieve it using the "Add data" itself. I missed to update/add the attachment type. After I added it I am able to open the attachment. Thanks for your input.

Show all comments

Hi everyone,

We created a custom entity that has a Contact lookup called [UsrConsumidor] and we need to get a value from a Contact's field called [UsrTotalPtsAcumulados].



We got an exemple from the bpm'online academy (https://academy.bpmonline.com/documents/technic-sdk/7-10/entityschemaqu…) and followed the exactly same structure, but it's not working. 

​var contactId = this.get("UsrConsumidor");
 
// Create Terrasoft.EntitySchemaQuery class instance with [Contact] root schema.
	var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
	rootSchemaName: "Contact"
});
 
// Add column with name of main contact of accounts that refers to given contact.
esq.addColumn("UsrVouchers.UsrConsumidor.UsrTotalPtsAcumulados", "ContactTotalPtsAcumulados");
 
// Get one record from selection on the basis of [Id] of card object and display it in an info window.
esq.getEntity(contactId, function(result) {
	if (!result.success) {
		// error processing/logging, for example
		this.showInformationDialog("Data query error");
		return;
	}
	this.showInformationDialog(result.entity.get("ContactTotalPtsAcumulados"));
}, this);

The error that is given in the console is: "errorCode: "FormatException", message: "Expected hex 0x in '{0}'." "

Am I doing something wrong or is there an easier way to get an object by ID?

Best regards,

Rogério Zampieri.

Like 0

Like

1 comments

Dear Rogerio,

You don't need to join tables, your root schema is already "Contact", you just need to specify the filter.

Moreover, please use this statement to achieve Id of the contact:

​var contactId = this.get("UsrConsumidor").value



 

​var contactId = this.get("UsrConsumidor").value;
 
// Create Terrasoft.EntitySchemaQuery class instance with [Contact] root schema.
var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
	rootSchemaName: "Contact"
});
 
// Add column with name of main contact of accounts that refers to given contact.
esq.addColumn("UsrTotalPtsAcumulados");
esq.filters.add("IdFilter", esq.createColumnFilterWithParameter(
				Terrasoft.ComparisonType.EQUAL, "Id", contactId));
 
// Get one record from selection on the basis of [Id] of card object and display it in an info window.
esq.getEntity(contactId, function(result) {
	if (!result.success) {
		// error processing/logging, for example
		this.showInformationDialog("Data query error");
		return;
	}
	this.showInformationDialog(result.entity.get("ContactTotalPtsAcumulados"));
}, this);

Regards,

Anastasia

Show all comments