Question

Answer object e-mail = Case number + Title

Hi community,

 

In the case section, I have the following case :

Pay attention to the e-mail object (test demail pour objet 2) and the case number (tpfPRO-2022...).

 

 

The OOTB functionnality is that, when I answer to an e-mail it puts automatically the subject of the e-mail to answer. What I want would be to have Subject = Case Number + E-mail object.

 

 

If you take the example above, it is written "Re: test demail pour objet 2".

What I want to have automatically is : "Re: PRO-2022... test demail pour objet 2".

 

How could I achieve that via code ?

 

Many thanks,

Jonathan

Like 0

Like

4 comments
Best reply

Hi Jonathan, 

The subject formation is performed by different methods, depending on the action you perform, although all of those methods work similarly. 

Let me explain: 



If you click "Reply", "Reply to all" or "Forward" , then the subject of the email is formed by the method getTitleForReply of EmailPageV2

getTitleForReply: function(actionTypeName, title) {
		var forwardActionName = EmailConstants.emailAction.Forward;
		var titleAdd = actionTypeName === forwardActionName
			? this.get("Resources.Strings.ForwardShablonCaption")
			: this.get("Resources.Strings.ReplyShablonCaption");
		return Ext.String.startsWith(title, titleAdd, true)
			? title
			: Ext.String.format("{0} {1}", titleAdd, title);

 

If you click "Reply to all with template", the subject is formed by the similar method :

getEmailTitle of SectionActionDashboard

getEmailTitle: function() {
	var emailTitleMessage = this.get("Resources.Strings.EmailTitleCaption");
	var title = this.getMasterEntityParameterValue("Subject");
	var number = this.getMasterEntityParameterValue("Number");
	return this.Ext.String.format(emailTitleMessage, number, title);
		}
	}

 

And lastly, if you just click on the letter icon on the section dashboard, 

the method getEmailTitle of CasePage is triggered(it's the same as the one on the SectionActionDashboard, altough the localizable string for the email subject differs). 



If you want to change the logic of the subject formation, you need to override these methods. You can basically create a replacing schema and override the OOB localizable string for email subject template, or rewrite the method your way. 



Best regards,

Yurii

Hi Jonathan, 

The subject formation is performed by different methods, depending on the action you perform, although all of those methods work similarly. 

Let me explain: 



If you click "Reply", "Reply to all" or "Forward" , then the subject of the email is formed by the method getTitleForReply of EmailPageV2

getTitleForReply: function(actionTypeName, title) {
		var forwardActionName = EmailConstants.emailAction.Forward;
		var titleAdd = actionTypeName === forwardActionName
			? this.get("Resources.Strings.ForwardShablonCaption")
			: this.get("Resources.Strings.ReplyShablonCaption");
		return Ext.String.startsWith(title, titleAdd, true)
			? title
			: Ext.String.format("{0} {1}", titleAdd, title);

 

If you click "Reply to all with template", the subject is formed by the similar method :

getEmailTitle of SectionActionDashboard

getEmailTitle: function() {
	var emailTitleMessage = this.get("Resources.Strings.EmailTitleCaption");
	var title = this.getMasterEntityParameterValue("Subject");
	var number = this.getMasterEntityParameterValue("Number");
	return this.Ext.String.format(emailTitleMessage, number, title);
		}
	}

 

And lastly, if you just click on the letter icon on the section dashboard, 

the method getEmailTitle of CasePage is triggered(it's the same as the one on the SectionActionDashboard, altough the localizable string for the email subject differs). 



If you want to change the logic of the subject formation, you need to override these methods. You can basically create a replacing schema and override the OOB localizable string for email subject template, or rewrite the method your way. 



Best regards,

Yurii

Yurii Sokil,

 

Thanks a lot for your explanations ! Sounds really good, I will try it and let you know.

 

Just a point about developing in Creatio, where can I find all the methods that can be overwritten from a base page ? For instance, where can I find all the base methods of the EmailPageV2 ?

 

When replacing the "EmailPageV2" schema and overriding the "GetTitleForReply" method, I get the following error :

 

 

The EmailConstants isn't recognized. Any idea on how to solve this issue ?

 

Many thanks,

Jonathan

Jonathan Quendoz,



Hi, 



in your define statement, you need to require the Email Constants : 

define("EmailPageV2", ["EmailConstants"],
	function(EmailConstants) {
		return {
			entitySchemaName: "Activity",
			messages: {},
			attributes: {},
			methods: {
here you override the method 
},
 
			};
});



Best regards,

Yurii.

Yurii Sokil,

 

Oh yes, sure. Thanks a lot for this.

Just a last question about this implementation, when I answer to an e-mail I have the object of the e-mail which is taken back into the object answer.

 

Into this title answer, I want to have something like : "Re: case number + title". The title belongs to the "EmailPageV2", however the case number belongs to another page, the "CasePage". How can I get the "CaseNumber" field from the "CasePage" to concatenante both the title of the email and the case number together into the "GetTitleForReply" method belonging to the "EmailPageV2" ?

 

In brief, how can I get the value of a field belonging to another page when I override a method into a determinate page ?

 

Many thanks for the help Yurii, again !

 

Best regards,

Jonathan

Show all comments