Announcements
I have to make subject field non mandatory on email template.
By default it is non mandatory, but when you open form Microsoft JS run and make it non mandatory.
Now when I try to put my JS and make it non mandatory it happens but when i try to save the form without any value, on save i get error. As on save MS JS run and give error of it's nulll value.
Any ideas how to resolve it.
Hi Ravi Fulani,
Yes, when you save the email template, there is a validation to check the subject is empty or not. Here is the code in the library(Activities/SystemLibraries/Template_main_system_library.js) of Email Template:
Template.validateSubjectSafeHtml = function (formContext) { var subjectSafeHtmlControl = formContext.getControl(Activities.Constants.Templates.SubjectSafeHtml); var subjectSafeHtml = subjectSafeHtmlControl.getValue(); var isSubjectValid; if (!!!subjectSafeHtml) { isSubjectValid = !!!subjectSafeHtml; } var removeSpace = subjectSafeHtml.replace(/[&]nbsp[;]/gi, "").trim(); isSubjectValid = !!removeSpace; if (!isSubjectValid) { subjectSafeHtmlControl.setNotification(Activities.ClientApi.getResourceString(Activities.Constants.Templates.RequiredFieldMustBeFilledIn), Activities.Constants.Templates.subjectSafeHtmlNotification); } else { subjectSafeHtmlControl.clearNotification(Activities.Constants.Templates.subjectSafeHtmlNotification); } };
So use JS to make it non mandatory can't be achieved. And Email Template is a special entity that doesn't allow to create a new form and edit the existing form.
This could be a way that you could make the subject begin with "Email Template:" and then add an onchange event on the Email's Subject filed.
If the subject starts with "Email Template:" then clear the value of the subject field.
André Arnaud de Cal...
294,208
Super User 2025 Season 1
Martin Dráb
232,970
Most Valuable Professional
nmaenpaa
101,158
Moderator