Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Initializing a new line using an action

(0) ShareShare
ReportReport
Posted on by 386

Hey community, 

I want to ask that how can we initialize a new line in a list part using an action. For e.g. in the picture below I want a new line to be initialized automatically whenever I execute a certain action as shown in the second picture. Moreover, if there isn't any way then how can we get the previous value on the new line without using xRec because we are not on the same page. Kindly help. 

pastedimage1672135531628v1.png 

pastedimage1672135681134v2.png

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Initializing a new line using an action

    Thanks Daniele but IncStr() worked for me.

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Initializing a new line using an action

    u can use this function "GetNextNo" in the codeunit 396 NoSeriesManagement

    pastedimage1672153350391v1.png

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Initializing a new line using an action

    hi

    look this

    usedynamics.com/.../

    the documnteo number in this case is a serial number, it is incremented automatically in this case when the write is balanced in credit and debit.

    DAniele

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Initializing a new line using an action

    Daniele one thing more I want to ask that in the above picture I shared, there is a field ("Document No.") whose datatype is Code[20] however the field is auto-incremented whenever a new line is created. Like in the above picture, for the first line "Document No." was G0001 and automatically when I initialized the new line the "Document No." becomes G0002. How can a Code datatype be auto-incremented? And how can I do that when I have to enter it manually?

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Initializing a new line using an action

    Hey Daniele your logic worked. Actually the functionality I was trying to achieve from this was a bit difficult that's it took some time but I used your logic and it worked. Thank you

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Initializing a new line using an action

    share your code pls

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Initializing a new line using an action

    Hey Daniele thanks for responding. Its not working

  • Verified answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Initializing a new line using an action

    hi

    try this

    pastedimage1672140379039v1.png

    DAniele

  • Manish Prasad Profile Picture
    317 on at
    RE: Initializing a new line using an action

    In that case, you need to do that with customization to make that function through a button.

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Initializing a new line using an action

    You are right Manish but the thing is that I do not want it that way. Either I need an action to do this or by appending the values from the first line to the next line.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,034 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans