Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

how to use a specific custom layout for a "type" of invoice?

Posted on by 198

Hi,

I want to know how I can use 2 different custom layouts based on some "type" of invoice.

NOT per customer, I really mean at the invoice level I want my finance team to select the layout they have to apply to my invoice.

we have 3 different processes in the company each one has some constraintys in term of invoice content and restrictions.

and for each of these processes we have a specific custom layout in place.

I could create 1 custom layout and add a bunch of condition into it, but it starts to be complicated to maintain, so if I can tell my invoice which layout to use it will be easier and this will allow us to add or change processes and layouts in the future.

thanks!!!

(same question for the credit memo)

Categories:
  • Jerome P1 Profile Picture
    Jerome P1 198 on at
    RE: how to use a specific custom layout for a "type" of invoice?

    I think (I have to confirm) we have some custom fields  already in place which can be used to identify the type of layout.

    and so, yes, we should be able to have some logic in place to read this field, identify the right layout to use

    Some design decision were taken without considering the multiple layout constraint, so I have to validate what can be done or not.

    (like read only fields, which may be changed to read write access...)

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,428 on at
    RE: how to use a specific custom layout for a "type" of invoice?

    You are welcome. yzhums  is provided that solution

    Do you think it is possible to write a code to determine the right layout and enter it in a field on header? I mean if any logic involved to select the right template then maybe you can write a code to replicate that logic and enter it in a field on header. Than make your report print code or webservice to look into that field to determine the right template to request or use.  

  • Jerome P1 Profile Picture
    Jerome P1 198 on at
    RE: how to use a specific custom layout for a "type" of invoice?

    oohhh... interesting.

    it's a good starting point I think.

    one of my constraint: we have some web service calls behind the scene calling BC to retrieve the PDF automatically.

    it's why I'm looking for something which selects the custom layout automatically.

    so my dream: no matter which interface is used, the right layout is used without any effort.

    but maybe I have no choice to create a custom web service which will select the right layout.

    and your sample code (thanks a lot) can be used for the interactive BC access (I can add or replace the print button to go through the select layout you provided)

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,428 on at
    RE: how to use a specific custom layout for a "type" of invoice?

    Hi

    Does a method like below works for you?  https://yzhums.com/25943/

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans