More in this section
Forums / Module Builder / Auto increment a field

Auto increment a field

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Foodsleuth
    Foodsleuth avatar
    46 posts
    Registered:
    21 May 2008
    09 Mar 2016
    Link to this post

    I created a small module using the module builder.  I have a numeric ID field. If I go into SQL and set that field as an auto increment field then try to add or edit a record in my module, will that work or will I get an error?

    Thanks

    Barb

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    18 Sep 2017
    14 Mar 2016
    Link to this post
    Hi,

    Making such a modification to the database is a not a supported scenario and will most likely cause a problem, even if it is not one that is immediately apparent.

    What I would suggest instead is to use the IDataEvent and some custom logic that checks whether the ID should be set to the next in order. If so finds the currently last one and sets it to next one.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered