Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Email template Subject field made non mandatory but error pop ups

(0) ShareShare
ReportReport
Posted on by 830

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.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Email template Subject field made non mandatory but error pop ups

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,208 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,970 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans