Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

How to append new value with the old value of a filed using plugin(C#)?

Posted on by Microsoft Employee

Hello Experts,

I have a requirement to update a field with old and new values using plugin.

For example i have a field on my case form named "Title",

so the title already contains the old value = "Sham",

and i want to append the new value ="Ram" with the old value "Sham".

Finally the revised title should be "Sham Ram".

Can i achieve this functionality using Plugin.

Thanks for your time ,

Please help me to achieve this functinality.

Categories:
  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to append new value with the old value of a filed using plugin(C#)?

    Hi Jakkani,

    It is possible to use plug-in to append new and old value to a field. 

    You could refer to the following code.

    //Set the update entity
    Entity case= new Entity("case");
    case.Id = Id;//you should get the record id first
    case.Attributes["Title"] ="Ram"+case.Attributes["Title"];//splicing string
    
    //Update
    service.Update(parententity);

    In addition, I recommend another OOB method through workflow.

    community8.PNG

    You could set up a workflow when you update the record and set the action to "append with".

    Hope it helps.

    Best Regards

    Leo

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: How to append new value with the old value of a filed using plugin(C#)?

    Yes, you can achieve it by plugin, workflow and java script.

    But you need to make sure that how this value get append: Actually plug-in and java script get trigger on event like  create, update etc.

    If you want to update this value manually then go for workflow. You can take help from below link:

    crmramblingsbysteven.wordpress.com/.../how-to-concatenate-two-fields-using-workflow-in-dynamics-crm-2011

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to append new value with the old value of a filed using plugin(C#)?

    Hi,

    If you don't want to use Plugins, then you can also achieve this by creating 2 real time workflow which triggers on before & after field update. The before workflows, sets the old value in some temp field and after workflow sets the name from the temp field and the new name field.

    Something similar to this but instead using 2 workflows-www.powerobjects.com/.../real-time-workflow-capturing-pre-and-post-values

    Post any issues here if you try this.

    Hope this helps.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to append new value with the old value of a filed using plugin(C#)?

    Hello,

    You can do that. You should do pre-operation plugin that will get "new" value from "Target" of InputParameters and "old" value from Pre-Image, concatenate and put it back to "Target". My recommendation - start doing it and if you experience issues just post your progress here. Here is where you can start - docs.microsoft.com/.../sample-create-basic-plugin

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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