I have created a signal-based Business Process that fires on modifying the data in Opportunity.

 

To Read the Email Template I write the following code:

using System;
	using System.Collections.Generic;
	using System.Linq;
	using Newtonsoft.Json;
	using Terrasoft.Common;
	using Terrasoft.Configuration;
	using Terrasoft.Configuration.Utils;
	using Terrasoft.Core;
	using Terrasoft.Core.Configuration;
	using Terrasoft.Core.DB;
	using Terrasoft.Core.Entities;
	using Terrasoft.Core.OperationLog;
	using SystemSettings = Terrasoft.Core.Configuration.SysSettings;
 
 
	public class EmailTemplateManager
	{
 
		private UserConnection _userConnection;
		private MacrosHelperService _macrosService;
		private readonly Dictionary<Guid, Entity> _cachedTemplates = new Dictionary<Guid, Entity>();
 
		public EmailTemplateManager(UserConnection userConnection) : base() {
			_userConnection = userConnection;
			MacrosHelperV2 macrosHelper = new GlobalMacrosHelper();
			macrosHelper.UserConnection = userConnection;
			_macrosService = new MacrosHelperService(macrosHelper, userConnection);
		}
 
		public string GetEmailTemplateSchemaName() {
			return _userConnection.GetFeatureState("EmailMessageMultiLanguage") == 0
				? "EmailTemplate"
				: "EmailTemplateLang";
		}
 
		public string GetTemplateBody(Guid recordId, Guid templateId) {
			var template = GetTemplate(templateId);
			if(template != null) {
				var schemaName = GetSchemaNameFromId(template.GetTypedColumnValue<Guid>("ObjectId"));
				var body = this.GetTemplateBody(new MacrosHelperServiceRequest
				{
					EntityId = recordId,
					EntityName = schemaName,
					TemplateId = templateId
				});
				return body;
			}
			return string.Empty;
		}
 
		public string GetTemplateBody(MacrosHelperServiceRequest request) {
			MacrosHelperServiceResponse template = null;
			string body = string.Empty;
			if (_userConnection.GetIsFeatureEnabled("EmailMessageMultiLanguageV2")) {
				template = _macrosService.GetMultiLanguageTextTemplate(request);
				body = template.TextTemplate;
			} else {
				template = _macrosService.GetMultiLanguageTextTemplate(request);
				body = template.TextTemplate;
			}
			return body;
		}
 
		public string GetTemplateSubject(MacrosHelperServiceRequest request) {
			MacrosHelperServiceResponse template = _macrosService.GetMultiLanguageTextTemplate(request);
			string title = template.SubjectTemplate;
			return title;
		}
 
		private bool IsNeedChangeMacrosCulture() {
			return _userConnection.GetIsFeatureEnabled("UseMacrosAdditionalParameters")
				&& _userConnection.GetIsFeatureEnabled("EmailMessageMultiLanguageV2");
		}
 
		public string GetTemplateSubject(Guid recordId, Guid templateId) {
			var template = GetTemplate(templateId);
			if(template != null) {
				var schemaName = GetSchemaNameFromId(template.GetTypedColumnValue<Guid>("ObjectId"));
				return GetTemplateSubject(new MacrosHelperServiceRequest
				{
					EntityId = recordId,
					EntityName = schemaName,
					TemplateId = templateId
				});
			}
			return string.Empty;
		}
 
		private string GetSchemaNameFromId(Guid objectId) {
			if(objectId != Guid.Empty) {
				var selectQuery  = new Select(_userConnection)
								.Column("Name")
								.From("SysSchema")
								.Where("UId")
									.IsEqual(Column.Parameter(objectId)) as Select;
 
				return selectQuery.ExecuteScalar<string>();
			}
			return string.Empty;
		}
 
		public Entity GetTemplate(Guid id) {
			Entity template;
			if (_cachedTemplates.ContainsKey(id)) {
				template = _cachedTemplates[id];
			} else {
				var esq = new EntitySchemaQuery(_userConnection.EntitySchemaManager, GetEmailTemplateSchemaName());
				esq.AddColumn("Object");
				esq.AddColumn("Subject");
				esq.AddColumn("Body");
				esq.Filters.Add(esq.CreateFilterWithParameters(FilterComparisonType.Equal, "Id", id));
				template = esq.GetEntity(_userConnection, id);
				_cachedTemplates.Add(id, template);
			}
			return template;
		}	
	}

 

To call this class in the Business Process I used this code:

try{
 
	var userConnection = GetUserConnection();
	var emailManager = new EmailTemplateManager(userConnection);
	var templateId = Get<Guid>("TemplateId");
	var recordId = Get<Guid>("RecordId");
	var subject = emailManager.GetTemplateSubject(recordId, templateId);
	var body = emailManager.GetTemplateBody(recordId, templateId);
	Set<String>("Body", body);
	Set<String>("Subject", subject);
}
catch(Exception ex){
	Set<String>("Subject", ex.Message);
	Set<String>("Body", ex.StackTrace);
}
return true;

 

 

To get the UserConnection in the background I used this Code:

private UserConnection GetUserConnection(){
	return Get<UserConnection>("UserConnection");
}

 

Here is the error I get:

Error Message: Error creating an instance of the "Terrasoft.Configuration.ILanguageIterator" class 

Stack Trace:   at Terrasoft.Core.Factories.ClassFactory.GetInstance[T](Func`1 action)
  at Terrasoft.Configuration.MLangContentFactory.GetContentKit(String iteratorTagName, String storeTagName)
  at QTECX.Email.EmailTemplateManager.GetTemplateSubject(String schemaName, Guid recordId, Guid tplId)
  at QTECX.Email.EmailTemplateManager.GetTemplateSubject(Guid recordId, Guid templateId)
  at Terrasoft.Core.Process.QTXTestEmailProcessMethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)

 

 

Like 0

Like

6 comments

I created the very same business process and manually specified RecordId (Id is a random Opportunity record) as 

 

new Guid("6344D6CE-F889-4361-83F2-9CD71DBD6300")

 

and TemplateId (Id is a random email template) as

 

new Guid("8F5C1959-25E0-45BC-A62D-04B516502A82")

 

in the process parameters and didn't get the error you received (checked the application logs dicrectly, BusinessProcess.log, Common.log and the Error.log files). Both the EmailTemplateManager class and the business process were created in the Custom package.

 

So the assumption is that either both the business process and the class on your end are created in an assembly package (or in separate packages, one of which is an assembly package) or the issue is in the parameters that the business process receives. Tested everything in the full bundle 8.1.4 application.

But we have to use this code in the Creatio 7.16 Version and it returns this error.

Syed Ali Hassan Shah,

You can order a trial site of 8.1.4 and check the suggested solution. If it works, please update the application to the newest version.

Anhelina,

We can not update the site to the latest version there are many complications in it Creatio Team already tried it once but didn't work out. Can you please suggest a solution for Version 7.16

Is there any update on the solution for Version 7.16?

Any update on this?

Show all comments

Hello, I am trying to run a report that will pull both from "Contact" and "Opportunity". My end goal is to run a closed lost report that I can download onto an excel document with the following fields:

  1. Company Name
  2. Contact Name
  3. Email
  4. Closed Lost in 2023
Like 0

Like

1 comments

Hello,

 

To solve this task, there are several ways. For example, you can use "Manage a list" for the "Opportunity" section and display the necessary columns in it. You can also display aggregated columns with the "Contact" object (you can read about this in the academy article).

After these actions, you will be able to filter the records you need in the list and export them to Excel.

 

Additionally, you can use an Excel reporting add-on available on the marketplace.

Show all comments

Hello,

 

as we use non-standard font for our report, it should be embedded into result pdf-file. FastReport has this option during export to PDF. But how can we achieve the same from Creatio?

Like 2

Like

3 comments

Hi Vladimir!



Fonts should be installed on the IIS side and the template also needs to be set up correctly to make them available.



The following instructions can help you to achieve the result you are looking for:

https://www.fast-report.com/en/blog/show/custom-fonts-online-designer/

Pavlo Sokil,

Thank you, Pavlo!



We have installed fonts on our Dev IIS server and it works.

But when customer has done the same, on their Test server it works, but on Production - not.



Can you give any idea what can be checked more?



Thank you!

Vladimir

Hi Vladimir.



There are several possible reasons why a custom font added to IIS for Fast Reports may work for one site but not for another, even with the same settings. Here are a few possible reasons:

  1. Different versions of IIS: If the two sites you are configuring the custom font for are running on different versions of IIS, this can cause compatibility issues. Therefore, depending on which version of IIS your sites are running on, you should use the corresponding version of the custom font.

  2. Different IIS settings: Another possible issue is different IIS settings on different sites. For example, if one site is working with custom fonts over HTTP, and another is over HTTPS, this can affect how the fonts are displayed on the site.

  3. Different font locations: It's possible that the fonts are not located in the same place on two different servers, and this can cause issues with loading the fonts on one of the sites.

  4. Caching: If the font is added to one site, and then you add it to another, the browser may have a cached copy of the old version of the font. This can cause the font to not change when you switch to the other site.

  5. If this is a self-hosted font, it may be necessary to modify the hosting settings of the font to allow access from other domains (perhaps by adding the instance address of Creatio to the Allowed domains list).

To address these issues, make sure you are using the correct version of the font, check if the settings are the same on both servers, make sure the fonts are located in the same place, and clear the browser cache.

Show all comments

Hi community!

We have moved our package from one environment with lowest creatio version (7.16) to environment with highest version (creatio atlas).

Some objects were not installed properly and we received error:

Error "Object is invalid. Extended properties are not permitted on 'dbo.UsrGeneralViewFile.FKcCbW9f8n8IYIlNxWjlw0Vi1Gqc', or the object does not exist." occurred when updating schema structure. SQL script text: "EXEC [dbo].[sp_addextendedproperty] N'TS.ActionType', N'ForeignKey', N'SCHEMA', N'dbo', N'TABLE', N'UsrGeneralViewFile', N'CONSTRAINT', N'FKcCbW9f8n8IYIlNxWjlw0Vi1Gqc'"

 

Any suggestions how to resolve it? 

 

 

Like 0

Like

2 comments

Hello Yana, 

 

We strongly recommend to transfer packages between sites with the same build (products) and versions to avoid any errors. 

It's hard to identify the root cause of the issue with no access to the system. But based on the shared information, I may assume that the issue is related to the lookup column that has no "Do not control integrity" option enabled in its settings and the issue occurs as the database structure for the object cannot be successfully updated while installing the package. I'd suggest to check it and as well fully generate and compile the system, and also resolve possible generation / compilation errors. 

If the issue persists despite the provided recommendations, please contact support team via support@creatio.com to proceed with investigation. 



Best regards,

Anastasiia

hi.

You do need to look at server logs.

SQL.json + Packages.log

You'll see there not only most recent error but first error, for example

"ErrorMessage":"The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FKcCbW9f8n8IYIlNxWjlw0Vi1Gqc"

The conflict occurred in database \"...........\", table \"<lookup_table_name>\", column 'Id'."

and only next - 'dbo.UsrGeneralViewFile.FKcCbW9f8n8IYIlNxWjlw0Vi1Gqc', or the object does not exist."

most probably, you have records in the lookup column of the table UsrGeneralViewFile that do not exists in your lookup table

Show all comments

Hi community!

I need to make a report where time(days) between lead stages is displayed.

For example:

Registration -> Qualification 5 days

Qualification -> Sale in Progress 8 days

Sale in Progress -> Opportunity in Progress 21 days

Opportunity in Progress -> Won/Lost/etc  54 days

Is it possible to calculate number of days between lead stages and display in the section list view or in any other way (dashboards, report etc)?

 

Like 0

Like

1 comments

Hello,

 

As for now, such dashboards cannot be build using OOB tools because Creatio doesn't store duration of the each Lead stage.

However, it stored start and end date of the stage so you can use this add-on to create more complicated dashboards:

https://marketplace.creatio.com/app/calculated-metrics-creatio

Show all comments

Hi community!

I am trying to add some validation in Lead section by setting business rules.

I need to make one field mandatory at two specific Lead stages for specific Customer needs.

As I am unable to group conditions I created like 5 different business rules. It seems it works only if one of them is enabled. If I have like both of them enabled then validations don't apply.

 

some examples:

 

 

Like 0

Like

3 comments

Hello,

 

this is correct, usually you cannot set more than 1 rule for a specific field.

 

The thing is that the system needs one parameter to change a fileld specified in the rule, and once there are two or more rules, the system does not understand which one to use, as the result - only one can be applied.

 

The good news is that group conditions are being developed and this feature should be enabled in the nearest verstion of the system.

 

Regards,

Gleb.

Gleb,

Thanks Gleb, did you know in what release this feature will be implemented?

Julio Falcon (Cibernética),

 

This feature was implemented in version 8.0.3, Freedom UI.

Show all comments

Hi community!

I need to make file attachment mandatory in Lead object (Attachments and notes) at Sales in progress stage. If there isn't any file attached I need to prohibit user to go to the next stage. Any suggestions?

Like 0

Like

4 comments

Hello,

 

In order to achieve the goal, you can use a business process in the case, which will check the "availablity" of the files and links to the details of the specified section. 

 

That will be nice to use in the business process the following element:

 

"read data", which will read the object "file and link <section name>"  according to the filter <section name> = id of the transfered record.

 

After that, using the formula, you will be able the check the availabillity of the files the the records of the corresponding section. 

 

 

Kyrylo Iudin,

Hello, thanks. Yes, I have done the check of file in that way, but after check is done how can I prohibit user to proceed to the next stages without file. Only manual transition is allowed between stages.

Yana,

Hello,

 

I am so sorry for misunderstanding. Currently such an option can't be achieved but i am sure we will do our best to add such a feature in future releases. 

Yana, you can achieve this in a business process in front end when the stage is changed and the file is missing then you roll back to the previous stage and you can also show a popup to the user that the file is missing.

Show all comments

Hi community!

have some questions about printables.

I have specified conditions for filtering record for printable. Until I select any record printable is inactive (unable to select it from PRINT list). Does it work only that way? Is it possible to make it active without selecting records as I have filtering conditions.

One more question. When I select several records and choose my printable I receive as many files as records selected. Is it possible to have only one file instead of several?

Like 0

Like

3 comments

Hello!

 

The system cannot recognize what has to be printed. Thus, it is necessary to click on the record in the section, so that it would be selected in the section list and the report button will become active.

 

As for one printable instead of multiple ones, unfortunately, it is not possible to implement your business task using custom methods of printables at the moment.

Word printables are uploaded this way: 1 document per 1 section entry.

Our development team already has a registered issue with your question. We have registered your idea of ​​unloading Word Printables on several section records and it may be implemented in future releases.

 

Best regards,

Yuliya Gritsenko

Yuliya Gritsenko,

Hello, 

Maybe it is possible to implement my business task with fast reporting?

Yana,

Hello,

 

FastReport functionality is not supported starting from version 8.0.3.

Show all comments

Hi community!

I want to move object from custom package to another package, let's call it X package. The problem is that when I set X package as default package my process do not see one field I want to use from that object. The object is added to both packages X and custom. The field I need is added to the object in custom package. I tried to move the object from custom to X package, but got error that X package already has that object. Any suggestions?

Like 0

Like

2 comments

Hey, there are two possible solutions that I can think of off the top of my head:

 

1. Create the field manually using code in the desired package and later delete the schemas from the Custom package. (This is less recommended).

 

2. Create a 3rd package, let's call it Y package, navigate to the dependencies of the X package and add a dependency to the Y package, move the files from the Custom package to Y package.

 

This should solve the issue for you as the field will be available in the Y package, and because X depends on it, it'll also be available there and thus it should work.

 

I hope this helps!

Edo Sagron,

thanks, will try!

Show all comments

Hello!



We have such a situation that numbers of notifications in CTI panel appears, but no notification is shown here. Or quantity of notifications differs from red number shown. And this situation is for many users.



How can be resolve this issue?



Thank you!



Like 0

Like

1 comments

Hello Vladimir,

 

Based on the shared information, I can assume that the issue may relate to the Visa object.

You may have a record in the SysModuleVisa table (this table stores the Visa's configuration) which refers to a schema that does not exist.

Due to this fact, that there is a reference to a scheme that does not exist, we cannot count the number of Visas. Therefore, the notification counter does not work.

You can find the mentioned record using this script:

select smv.* from SysSchema ss

right join 

SysModuleVisa smv on smv.VisaSchemaUId=ss.[UId]

where ss.id is null

 

If the solution provided above doesn't solve your issue, please contact the Creatio support team via support@creatio.com, so we could proceed with investigation.

 

Best regards,

Anastasiia

Show all comments