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

No. Series is not working through API using the Item Template

(0) ShareShare
ReportReport
Posted on by 40

Hi, 

We are using Power Automate to synchronise the item from CRM to BC. We setup the item template in BC API Setup. Items were created successfully with all the preset in item template except the No. Series.

The item created through Power Automate takes the No. Series of ITEM instead of ITEM-CRM. I also tried to create item in BC using the template ITEM_1 and the no. series of ITEM-CRM was used perfectly. So only through the API got that issue. Any idea if I missed any configuration? Thank you.

  • Environment
    • Business Central Cloud Version
  • Item Template
    • Name: ITEM_1
    • No. Series: ITEM-CRM
    • Type: Non-Inventory
    • UoM: EACH
    • Item Category Code: SAL00001
    • GST Posting Group: GST15
    • Gen. Prod Posting Group: SAL00001
  • Inventory Setup
    • Item No: ITEM
  • API Setup
    • Order: 0
    • Table ID: 27
    • Page ID: 5470 (I tried other two item pages #20008 and #30008 as well. same...)
    • Template Code: ITEM_1
    • Condition: when item category code is SAL000001
  • Lillian Du Profile Picture
    Lillian Du 40 on at
    RE: No. Series is not working through API using the Item Template

    Hi Steve,

    Thanks so much. It clearly shows why the No. Series is not working through API as expected.

    We will live with that for now and use item Category to identify the different category of the items. Thank you.

    Cheers,

    Lillian

  • Verified answer
    steveendow Profile Picture
    steveendow 2,281 on at
    RE: No. Series is not working through API using the Item Template

    Hi Lillian,

    I got some help from AJ Kauffman, who showed me where to look for the API code that applies the Templates.

    From what I can tell, the BC API page inserts the record first, and then the API Setup code is run to apply the template to update the inserted record.  Because the Item is inserted before the Template is applied, it defaults to using the No. Series from the Inventory Setup page.

    pastedimage1614119933791v1.png

    I am not yet able to decipher the actual template field update code, but my guess is that API Setup does not attempt to use the No. Series from the Template because that would require that it modify (renumber) the existing Item No. value for the new item record.  

    If my understanding is correct, I can guess why this limitation exists.  Presumably re-numbering an existing record is a more involved process.

    But on the other hand, that is unfortunate, as I can imagine lots of scenarios where one might want to use different number series for imported records, whether those are items, customers, vendors, sales orders, etc.

    I'm now wondering if it is possible to create a custom API that will lookup the Template, retrieve the next number from the No. Series, and assign it to the Item during the API call.  Likely possible, but it would be custom.

  • Verified answer
    steveendow Profile Picture
    steveendow 2,281 on at
    RE: No. Series is not working through API using the Item Template

    I reviewed the code for the Items API page and I'm not seeing any code to lookup or use the Item Template from the API Setup page. So it seems that is being done through some other code.

    I'm going to check with a friend to see if he knows where the API Setup & Template is being invoked.

  • Verified answer
    Lillian Du Profile Picture
    Lillian Du 40 on at
    RE: No. Series is not working through API using the Item Template

    Much appreciate. :)

  • steveendow Profile Picture
    steveendow 2,281 on at
    RE: No. Series is not working through API using the Item Template

    Hi Lillian,

    I have setup a few new item number series and configured the API Setup with a few Item Template Codes based on Type and Item Category Code.

    pastedimage1614043124411v1.png

    I am seeing the same behavior that you describe.  Items imported via the BC web API are using the default item number series from Inventory Setup.  The API appears to be ignoring the No. Series assigned to the templates and always relying on the Inventory Setup series.

    I'm going to review the AL code for the Item API page to see if I can confirm it lacks the code to use the No. Series from the template.

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…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans