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...
Suggested answer

How to recreate the functionality of "Create item from Item No"

(1) ShareShare
ReportReport
Posted on by 140
Hello, I have another table in which I want to implement the functionality of creating a new item card (or other table item) from typing it into (similar to) sales line.
I have a logic in mind which goes as follows
1. after typing into the line column, it will check the existing table for the item whether it exists or not
2. if it does not exists then it will provide a prompt message whether you want to create new item with that name
3. the typed name should be used as the primary key on creation of new item, it should not take the default number series.
4. it open up the card for filling up of further details
5. once done other related fields will get populated into the line
 
please suggest some references to get idea to work up with the code.
  • Suggested answer
    Tech_BC_Gokul Profile Picture
    331 on at
    How to recreate the functionality of "Create item from Item No"
    Hi 

    You can use the below to achive your requirement 
     
     GetSalesSetup();
     DefaultCreate := ("No." = '') and SalesSetup."Create Item from Description";
    if Item.TryGetItemNoOpenCard(
      ReturnValue, Description, DefaultCreate, not GetHideValidationDialog(), true)
    then
    case ReturnValue of
        '':
         begin
            LookupRequested := true;
            Description := xRec.Description;
         end;
       "No.":
            Description := xRec.Description;
          else begin
            CurrFieldNo := FieldNo("No.");
            Validate("No.", CopyStr(ReturnValue, 1, MaxStrLen(Item."No.")));
          end;
    end;
  • Suggested answer
    Mustafa Omerbegović Profile Picture
    1,280 Super User 2025 Season 1 on at
    How to recreate the functionality of "Create item from Item No"
    Hello,

    this what you described is very similar to Create Item from Item No. functionality and maybe the only difference between native functionality and the steps that you are listed is the 3. step where you want to use Name as PK, instead of No. series defined for selected Item Template. You can try using native functionality and set No. series, that will be linked with Item Template as Manual Nos., so that after populating Default Nos. you can change the No. on the Item Card. Since it is a new item you will have no problem with changing No. series.
     
    Greetings

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,129 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,895 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans