web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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 836

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.

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans