web
You’re offline. This is a read only version of the page.
close
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 390

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

I have the same question (0)
  • 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
    390 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,397 on at

    hi

    try this

    pastedimage1672140379039v1.png

    DAniele

  • Muhammad Anas Naeemi Profile Picture
    390 on at

    Hey Daniele thanks for responding. Its not working

  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    share your code pls

  • Muhammad Anas Naeemi Profile Picture
    390 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
    390 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,397 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,397 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,064

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,568 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,063 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans