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 :

Business Central Custom Connector for standard API

JAngle Profile Picture JAngle 133

A few weeks back I sent out the below tweet:

It was in relation to the creation of a dimension value using the standard BC API page – Create dimensionSetLines (docs_on_this), whilst using Power Apps or Power Automate. If you have this working then reach out. If not then you might find my workaround worthwhile. Maybe a quick rewind  is needed here for clarity. Let’s say you had a requirement to create new general journal lines and assign dimensions values, to the created journal lines. Power Apps or Power Automate might be where you want this to take place. You will therefore make the most of the BC API to complete this, via the BC connector. However, when it comes to assigning the dimensions things start to look a bit weak:

The results in Power Apps are similar, the method is just different. Back to my tweet . A couple of responses came back but it didn’t result in a definitive answer. Made me consider is this even something I should concern my time with? This is where this post comes into play!

Personally, I think the standard BC API can be a bit too complex for certain aspects of the Power Platform. Take the Power Apps patch() function, for example – it expects a nice and neat tabular data source to work with. But are the standard BC API pages really designed to provide that? If you check out the documentation link, you’ll see a sample HTTP request. I’ve included a brief example below. Essentially, this request allows you to get to the final destination table by using the reference of another table. However, PowerApps and Power Automate don’t always follow those rules. So, is this the best approach? We can’t exactly change the approach, but we can explore some alternatives, right?  :

POST businesscentralPrefix/companies({id})/journalLines({id})/dimensionSetLines({id})

 To overcome the complexities of the standard BC API when working with the Power Platform, my go-to solution is to use a Power Platform custom connector. With this option, you can define the rules and work around the limitations of PowerApps or Power Automate’s standard functions. I found this blog post that provided crucial insights into how to use OAuth2.0 with a Power Platform custom connector for BC: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/How-to-use-OAuth2-0-in-Power-Automate-Custom-Connector/ba-p/1260216

The swagger definition is available on my GitHub (github_link), so you can just import that, if you agree with my approach. This could be applied as an alternative to having to create a Power Automate flow which uses HTTP (previous post explaining this concept: previous_post). While it’s not necessarily a bad approach to use HTTP, it’s always nice to have all your working parts in one place, isn’t it? Additionally, with the custom connector, you can avoid having to perform OAuth2 within the flow, as it’s already built into the connector.

Over in PowerApps you can see what the custom connect allows for. Each of the different elements needed are treated as parameters, giving you a flexible connector.

Does this method apply to other parts of the BC API setup? Yes, in short. Here are a few other pages which could use this very same custom connector approach:


This was originally posted here.

Comments

*This post is locked for comments