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

Announcements

No record found.

News and Announcements icon
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 436

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

  • Suggested answer
    Manish Prasad Profile Picture
    325 on at

    Hello Muhammad ,

    As for now if you are asking, to auto create the initial 5 fields on the payment journal page, it is already a standard function. Just create a line complete one and then click on the below line, it will create a line uptAccount Type field, after that you just need to fill the remaining fields.

    Correct me if I understand it wrong.

    If my answer helped you, maybe it can help others, please verify it, so other users know it worked or helped you.
    Thank you.

  • Muhammad Anas Naeemi Profile Picture
    436 on at

    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.

  • Manish Prasad Profile Picture
    325 on at

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

  • Verified answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    hi

    try this

    pastedimage1672140379039v1.png

    DAniele

  • Muhammad Anas Naeemi Profile Picture
    436 on at

    Hey Daniele thanks for responding. Its not working

  • Suggested answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    share your code pls

  • Muhammad Anas Naeemi Profile Picture
    436 on at

    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

  • Muhammad Anas Naeemi Profile Picture
    436 on at

    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?

  • Suggested answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    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

  • Suggested answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

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

    pastedimage1672153350391v1.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 711 Super User 2026 Season 2

#2
Teagen Boll Profile Picture

Teagen Boll 377 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 367 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans