Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Number sequence generation

Posted on by 50

Hi all,

I  have a custom table say "XXXTable"

where field "RequestNumber"  is mandatory - for which number sequence will be assigned

Scenario:

  i am creating web service;where i assign all the field values

  and ill do all the validations (including validate field, validate write) ; once if all the validations succeeded the record should be created

  Problem is since the "RequestNumber" is mandatory  i need to assign the number sequence value to it ; therefore if the user creating the records multiple times with error then  number sequence will be used for that many error records;

NEED:

1. when i create a record with invalid data - number sequence value should be in free list (say number sequence value is HMA_003)

2.  when i create a record with invalid data - number sequence value should be in free list 

2. When i create a record with valid data - number sequence should use the value from free list (HMA_003 should be useD rather than using the value HMA_005)

  • Suggested answer
    A.Prasanna Profile Picture
    A.Prasanna 8,163 on at
    RE: Number sequence generation

    Okay. Mean you are not assign any number for Request Number Initially , But Request Number is Mandatory ?

    if that is the case, it think you can either assign another number sequence Temporarily, and  upon validation you can update record from original no sequence or   you can assign number from your original Number Sequence but with Status Flag ( Eg : Valid /Not Valid)

  • Hasini N Profile Picture
    Hasini N 50 on at
    RE: Number sequence generation

    Thanks for the reply

    the thing is " ill call the validate write in the validation part ; since the request number is mandatory field.if i dont assign the value for the request number. error will be thrown in the validatewrite() method itself"

  • Suggested answer
    A.Prasanna Profile Picture
    A.Prasanna 8,163 on at
    RE: Number sequence generation

    No just to add field for the Status ( Eg; base Enum with Valid /Invalid values)

  • Hasini N Profile Picture
    Hasini N 50 on at
    RE: Number sequence generation

    are you asking me to use 2 number sequence

  • Suggested answer
    A.Prasanna Profile Picture
    A.Prasanna 8,163 on at
    RE: Number sequence generation

    I think you better add Flag (Status) based on Validation result , while keeping original number sequence

    By using that you can filter record easily and same time you can use that flag for later use (eg: for Workflow to reset and resubmit ).

    Hope this will help.

    Thanks ,

    Amith Prasanna

  • Hasini N Profile Picture
    Hasini N 50 on at
    RE: Number sequence generation

    yes am using original number sequence only ..but i should not use another number sequence.is there any other alternative solution

  • A.Prasanna Profile Picture
    A.Prasanna 8,163 on at
    RE: Number sequence generation

    So simply you asking ,

    if the record is properly validated you need to use Original Number Sequence ,  and if your record has not pass the validation you still need to retain that records , but with another number sequence is it ?

    Regards,

    Amith Prasanna

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

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

Product updates

Dynamics 365 release plans