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 CRM (Archived)

Make Notes Mandatory

(0) ShareShare
ReportReport
Posted on by

Hi experts , 
I am asking how can make notes section mandatory in service activity form in CRM 2015 ?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    TheMarkChristie Profile Picture
    10,328 Moderator on at

    Hi Martina

    This is not as simple as it sounds as notes (Annotations) is its own entity so therefore it is difficult to do so,

    I would recommend that you create a Notes for this activity (multi line text) and make this mandatory - then on save have a workflow update the notes and clear the "Notes for this activity" field

  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Hi Martina,

     notes section is not a "field", so you can't make it mandatory (you can't even create a note until you have created a service activity).

     Maybe create a new field in the service activity entity, add it to the form, call it "notes", make it mandatory.

     Use a workflow to create an actual note based on the input in that new field.

     Then use javascript to hide that new field on those service activities where the field has already been populated (if you want to be using notes section)

     Users can still delete notes, so what is supposed to happen when the last note is deleted.. not sure about that - may need a plugin to do some extra validations.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Martina,

    As also suggested above, the best option would be do have a a separate field on the entity itself to store notes and then use the logic to add that note to the actual notes entity.

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Martina ,

    Notes is an optional in ms dynamics CRM and its not a field.As Mark,Rabih,Alex here suggested to create new field and workflow to update notes.You can go for this because it's best practice to do through workflow instead of writing plugin.

    However as an alternate options or if you have any existing plugin for this entity you can try to implements in plugin.

    public class ValidateNote : IPlugin

    {

       public void Execute(IServiceProvider serviceProvider)

       {

           IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

           IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

           IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

           if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) {

               Entity note = (Entity)context.InputParameters["Target"];

               // you can also use "subject" instead of "description"

               if (string.IsNullOrEmpty(note.GetAttributeValue<string>("description")) || string.IsNullOrEmpty(note.GetAttributeValue<string>("filename")))

               {

                   throw new InvalidPluginExecutionException("Please add an attachment and description");

               }

           }

       }

    }

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans