Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Make Notes Mandatory

Posted on by Microsoft Employee

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

*This post is locked for comments

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Make Notes Mandatory

    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");

               }

           }

       }

    }

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Make Notes Mandatory

    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.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Make Notes Mandatory

    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.

  • Suggested answer
    TheMarkChristie Profile Picture
    TheMarkChristie 10,328 on at
    RE: Make Notes Mandatory

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans