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

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Record cloning / copying

(0) ShareShare
ReportReport
Posted on by

Hi All,

As the title says I am having issues with cloning a record.

I am using an ajax call to achieve the former as it allows me to get the new record id and open the entity form automatically. It all works fine except for when I try to maintain a field value to the same as the original record. This field is an autonumber field which uses a plugin that I have written and it has been working great so far.

What I am try to achieve is a mechanism of revision (Name and all the data within the clone record will be the same as the original, apart for a revision number which will be incremented every time a revision is done)

Every time I create a new record it gets a unique number assigned to it (which is fine in case of a "brand new" one) but as soon as I try to clone it maintaining the old number then I get an internal server error from the ajax.

I know I could bypass the plugin execution by putting a dummy yes/no field and check it's value inside it to decide what to do. But before proceeding with it I would like to know if there is a better and cleaner way to achieve this.

Thanks for you time

Christian

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Let's say it's an order record and you have

    Name = Order123

    RevisionNo = 1

    Customer = Customer Co

    if you clone it sans the Revision no, it should end up as

    Name = Order 123

    RevisionNo = null

    Customer = Customer Co

    and then the RevisionNo is set by a synchronous oncreate plugin, correct?

    I don't see why this would throw an error. Are you sure it's this field causing it?

    What does the reponse from the call say? Is the ajax call synchronous or async?

  • Community Member Profile Picture
    on at

    Hi Erik thanks for your response,

    I have tried using both sync and async ajax with no luck.

    The scenario you described is slightly different:

    I have a record like the following:

    Name = Order123 (autogenerated - this means that the next time I create an order it will be "Order124" - this is done via plugin)

    RevisionNo = 1 (it defaults to one at the time of creation)

    When I press "Revise" I want to get:

    Name = Order123(This should not be incremented)

    RevisionNo = 2 (whatever the previous revision plus 1)

    The problem I am facing is that if I create a record without specifying the autonumber, the plugin automatically assigns the next available one (and this is not what I want in this case, I want this to happen on creation of brand new records)

    If I, however, specify the number to be the same or whatever else (if the field is not null) then I get the internal server error

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi ChristianCRM91,

    I think you should have create new field which store previous unique number for the reference.

    Let me know if you require something more.

    Thanks

    Regards,

    AW

  • Verified answer
    Community Member Profile Picture
    on at

    Hi all

    I have found the cause to this problem and it was due to the fact that the field had a character limitation. At the time of testing I was using a string which exceeded the limit, hence why the error.

    Schoolboy error from my side.

    Thank you for you time

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ZS-27011425-0 Profile Picture

ZS-27011425-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans