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)

Title in Notes For Cases

(0) ShareShare
ReportReport
Posted on by

I asked the question a few days ago how to make the Title Required and got an answer the worked perfect.  But it now seems the business would like that field Auto-populated so the employee does not have to fill it in themselves.  I have look at the same real-time workflow the checks if the fields has contact but did not find a way to populate the field.  Seems odd you can check the condition of the field but not update it.  So I was thinking I am missing something here.  I tried to google this but just found one that used a plugin and could not figure out how to get the plugin to install.  I am running on Prem.

*This post is locked for comments

I have the same question (0)
  • Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hi Mike,

    It depends on what information you want to autopopulate in Notes? Based on that we can decide whether should we go ahead with Real-Time Workflow or Plugin.

    -Arpit

  • Community Member Profile Picture
    on at

    The Title of the Notes is what I need to Auto Populate and was thinking of using Created By and Created when for the Title.

  • Verified answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hi Mike,

    You need to go with Plugin to accomplish this requirement.  Write a plugin on Note Entity (Post-Operation Stage)

    Here is the sample code.  Can change according to your requirement. Hope it helps.

    using System;
    
    using System.Collections.Generic;
    
    using System.Linq;
    
    using System.Text;
    
    using System.Threading.Tasks;
    
    using System.ServiceModel;
    
    using Microsoft.Xrm.Sdk;
    
    using Microsoft.Xrm.Sdk.Query;
    
    namespace SamplePlugin1
    
    {
    
        public class AutopopulateNote : IPlugin
    
        {
    
            public void Execute(IServiceProvider serviceProvider)
    
            {
    
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    
                IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    
                IOrganizationService service = (IOrganizationService)factory.CreateOrganizationService(context.UserId);
    
                ITracingService TracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
                // The InputParameters collection contains all the data passed in the message request.
    
                if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
    
                {
    
                    // Obtain the target entity from the input parameters.
    
                    Entity entity = (Entity)context.InputParameters["Target"];
    
                    // Verify that the target entity represents an account.
    
                    // If not, this plug-in was not registered correctly.
    
                    if (entity.LogicalName == "annotation")
    
                    {

                                                 if (context.OutputParameters.Contains("id"))
                                                {

                          Guid createdNoteId= new Guid(context.OutputParameters["id"].ToString());
                        // Create a column set to define which attributes should be retrieved.
                        ColumnSet attributes = new ColumnSet(new string[] { "createdon", "ownerid","title" });
    
                        // Retrieve the Note and its createdondate and ownerid attributes.
                        Entity noteObj= _service.Retrieve('annotation', createdNoteId, attributes);
                       
    string createdOn = noteObj["createdon"].ToString();
                        string ownerName= ((EntityReference)noteObj["ownerid"]).Name;

                                           noteObj['title'] = "Notes Created By: "+ownerName+" at"+createdOn;

                                            service,Update(noteObj);

                                                }

                    }
                }
    
            }
    
        }
    
    }



    If my answer helped to resolve your issue, kindly verify it by clicking 'Yes'. It would be helpful to the other community members seeking to resolve a similar issue.

    Cheers
    Arpit
    https://arpitmscrmhunt.blogspot.in

  • Community Member Profile Picture
    on at

    Thanks for the quick response.  This looks like what we need.  We have not dealt with plug ins before but looks like sometime that we can handle.  If not I might be asking more questions.  Thanks Again

  • Community Member Profile Picture
    on at

    So We got this working but there is one item I am trying to see if we can accomplish and that is when the user clicks done the title does not show unless you refresh the page.  Is there a way to get the title to show when they click done with out having to click the refresh page in the browser?

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