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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Server Side Code/ C# - getting field values

(0) ShareShare
ReportReport
Posted on by

I am new to D365 online. I have built a couple of basic solutions with out of the box features that just takes and stores information. I want to take the next step of taking that user input and manipulating it on the server side after the user submits/saves that data. 

I already know that i have to create a .dll in visual studios, make reference to the D365 sdk lib, and the format of the dll (ex. the class, IPlugin, and execute function).

My question is:

1. When a user saves a record, how do i read the information from the entity form submitted - for example, a string/value in a textbox from a entity form.  Also, if that value was a normal text file with a string in it, how do i get that information?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Priyesh Profile Picture
    7,396 User Group Leader on at

    Hi merc718,

    Though I assume you want to do some processing on a field when it is submitted. You can write a plugin or even a JS code on the form onSave.

    But since I'm not aware how much of plugin/JS for D365 experience you have, I'll suggest the following -

    You can read the JS code - as Xrm.Page.getAttribute("fieldname").getValue(); in JS code that you can put onSave on the Form where user is entering data.

    OR

    You can read the field in Plugin code as

    Entity entity = context.InputParameters["Target"];

    String name = entity.getAttributeValue<String>("fieldname");

    and then do operations on the name in C#.

    Let me know if you have even more particular question depending on whether you are trying to do this in JS or in Plugin and I can suggest in a better way.

    Apart from this, you can even check out how Calculated Fields and Business Rules work. Maybe that'll also help you instead of code if your business logic is straight forward.

  • Community Member Profile Picture
    on at

    You are right, i want to do some type of processing when the information is submitted. The coding needs to be on the server side bc the amount of work that will be done will be heavy.

    Just for clarification - when you use the word "plugin", are you referring to server side code? how does Microsoft define "plugin"?

    Another question:

    is the MS site : docs.microsoft.com/.../mt676547(v%3dcrm.8) , the site i need to use to refer to information like the one you provided (ex. Entity entity = context.InputParameters["Target"];) ? or, is there another site?

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Merc

    You can write plugin with "Create" message. Below is the code

              IOrganizationService service = localContext.OrganizationService;

               IPluginExecutionContext context = localContext.PluginExecutionContext;

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

               {

                   Entity entity = (Entity)context.InputParameters["Target"]; // read the information from the entity

                   if (entity.Attributes.Contains("emailaddress1") && entity.Attributes["emailaddress1"] != null)

                   {

                       string emailAddress = entity.Attributes["emailaddress1"].ToString(); // a string/value in a textbox from a entity

                   }

               }

    Hope it helps.

    Thanks,

    Ridhima Behl

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans