To upload new fonts and use them in emails, you need to change the values of the system settings "CKEditor fonts list" ("CKEditor fonts list") and "CKEditor default font" ("CKEditor default font").
The "CKEditor fonts list" system setting is responsible for which font you will be able to see in the font drop-down list. It should be added to the beginning of the system setting list, with ";".
Accordingly, in order to use this font, they just need to be installed on the server as a regular font.
It is also necessary to know that if the recipient does not have this font, he will not see this font.
I'd liket to create a script task in a business process, that given an email template, it executes it on a specific context. I mean, if the email template is based on a custom macro related with the Lead entity, I can pass the LeadID and the emailTemplateId to the script task, and the result is the text of the email template executed for that specific lead.
You can pass LeadId and the TemplateId as process parameters (create two Guid parameters in the process settings). Then you can use the "Read data" element and read specific columns of the lead record (use the LeadId parameter in the "Read data" filtration to get the value for needed columns). Then you can create additional text parameters and pass the read column values to them (using formulas for example). The same approach is for the "Email template" object and TemplateId parameter (you need to get the template body, so you need to read it in the "Read data" process element). And finally you can use string interpolation (or String.Replace method) in the script task to replace macroses (macorses, not their values, like [#UsrSomeColumn#], it's passed in the template body) with the actual values read from the "Lead" object using the "Read data" element (the ones that we wrote to the process parameters). To get process parameters values in the script task you need to use Get<string>("ParameterCode") (see more examples here) construction in the script task, then you can use String.Replace in the following manner:
And then you can return EmailTemplateBody to some another string parameter value using Set<string> command and as a result you will get the result needed.
Right, that would be the "manual" approach. I was hoping I could reuse the same service that is being used when creating an email from a template. For example, I can use a ReportService to generate a printable inside a business process. I was hoping that we have in Creatio something like "EmailService" that processes an email template and returns the generated text.
You need to use the script-task to send the email from the code directly. Please see this Academy article that describes how to form and send the email from the code (this article also have examples of implementations, please use the "Examples" tab at the top of the article).
There should be also the following parameter values:
1) the code is ContactEntityName - Text (50 characters) data type ("Contact" value by default) - represents the object from which data for macros is selected
2) the code is ContactRecordId - Unique identifier data type - represents the record Id to get data for macroses
3) the code is ResultEmailTemplateHTML - Unlimited length text data type - contains the template with filled macroses
4) the code is ResultEmailTemplatePlain - Unlimited length text data type - contains the template without filled macroses
Also you need to add the following namespaces to the process usings:
Terrasoft.Configuration.Utils
Terrasoft.Core.Factories
You need to use the "Read data" process element and read specific email template (the object is "Message template") and you need only the "Body" column value. Then the read body of the template should be passed to the "ResultEmailTemplatePlain" parameter using the "Formula" process element.
As a result of the script-task process element you will get the formed email template body with filled macroses in the ResultEmailTemplateHTML parameter that can be then displayed for example using the autogenerated page.
I have a requirement to add fields for multiple records from the connected detail along with fields from the macro object (1:M Relation). Can anyone suggest how to achieve this task?