top of page
  • Writer's pictureAlan Campbell

Traverse API Challenges: Canvas Apps & Business Central

Navigating the intricacies of API integration within Microsoft Business Central can often feel like navigating a labyrinth, especially when you're trying to incorporate these capabilities into your canvas app through a custom connector. The path to seamless integration is fraught with challenges, one of which includes debugging and identifying failure points that might obstruct the flow of data as expected.


A visual metaphor depicting a developer navigating a labyrinth, symbolizing the complex journey of API integration with Microsoft Business Central through a custom connector in a canvas app, with challenges such as debugging and resolving data flow issues highlighted by an example of unexpectedly empty fields on the app screen.
Navigate On-Prem Business Central API Challenges

Imagine encountering a scenario where certain fields on your canvas app screen are unaccountably empty, despite being connected to an on-premise Business Central system. It's situations like these where your skills in pinpointing and rectifying the issue are put to the test.


In this blog, we delve into a structured approach to troubleshoot and resolve such issues. Whether you're a seasoned developer familiar with the nuances of API calls and Swagger documentation, or someone taking their first steps in custom connector development, the insights shared here are invaluable. We'll guide you through a methodical process starting from examining the canvas app configuration, scrutinizing the custom connector setup, and even leveraging external tools like Postman for an independent verification of the API responses. By the end of this journey, you'll be equipped with the knowledge to not just identify but also rectify the elusive failure points in your integration process, ensuring a smooth and reliable data flow from Microsoft Business Central to your canvas app. Let's embark on this troubleshooting adventure together.


Checking the Canvas App


Begin your troubleshooting process by first ensuring that the screen object is correctly linked to the anticipated data collection. This step might seem straightforward, yet it's crucial, especially since field names can often appear very similar to the one you're aiming to display.


For instance, in scenarios where I employ a Data Table, it's essential to meticulously examine the Text property. Carefully check the field you've chosen to ensure it aligns with the expected data field. This initial verification can save you time by identifying simple mismatches that might otherwise be overlooked.


A developer closely inspecting the Text property settings of a Data Table in a canvas app to verify correct linkage between screen objects and data collections, highlighting the importance of ensuring accurate field selection to prevent data mismatches.
Validate Screen Objects

Moving forward, the subsequent step involves confirming that the collection's contents match your expectations. To achieve this, there are a couple of straightforward methods to inspect your collection's data. Firstly, you can initiate this process by double-clicking on the variable within your code. Following this action, click on the name of the variable located at the bottom of your code window. This action allows you to scrutinize the variable's contents thoroughly, ensuring they align with what you anticipate. This method serves as a simple yet effective way to verify the accuracy of your data collection.


A developer double-clicking on a variable in their code to open a detailed view of the collection's contents at the bottom of the code window, ensuring the data aligns with expected outcomes as part of the data verification process.
Review Collection Contents

For the second method of examining your collection's data, begin by clicking on the (x} found in the left panel of your interface. Subsequently, locate and click on the three dots positioned adjacent to the name of the table. This action will facilitate a deeper inspection of the collection's contents, offering an alternative approach to ensure the data integrity and alignment with your requirements.


A user navigating through the user interface, clicking the close button (x) in the left panel, then selecting the options menu (three dots) next to a table name to access and inspect the detailed contents of a data collection for integrity and alignment with project requirements.
Review Collection's Data

Should your collection have been established via an $expand operation, it becomes necessary to delve deeper into the specific table to examine the records fetched by the call. During this process, it's important to be aware that some data might not have been included during the initial parsing of the returned record. This oversight can occur and warrants a thorough investigation to ensure no critical data has been inadvertently left out.


The subsequent phase involves invoking the canvas app monitor to meticulously trace the operations you perform. It's crucial to understand that the data you observe in the monitor reflects the perspective of the custom connector. Although data may appear within the monitor, it doesn't guarantee its presence in your canvas app's collection. To access the monitor, navigate to 'Advanced Tools' located in the left pane, and select 'Open Monitor'.


Utilizing the monitor presents a significant advantage by offering a detailed insight into the workings of your function call. This enhanced visibility might reveal error messages or other indicators that can shed light on the underlying issue. Such granular information is instrumental in diagnosing and resolving the problem effectively.


A developer opening the canvas app monitor from the 'Advanced Tools' menu in the left pane to track and analyze operations, highlighting the connection between monitor data and the custom connector, and emphasizing the importance of this tool in uncovering error messages and providing detailed insights for effective problem-solving.
The Monitor

Checking the Custom Connector


Should the canvas app fail to reveal the root of the missing data, the next logical step is to turn your attention to the custom connector. This tool is equipped with a testing functionality that allows for the evaluation of your endpoints through manual input.


A developer shifting focus to the custom connector to utilize its testing functionality for endpoint evaluation, indicating a strategic move to diagnose issues with missing data when the canvas app does not provide clear insights
The Custom Connector

The primary benefit of employing this testing feature lies in its ability to conduct thorough endpoint examinations at the most fundamental level within the Power Platform. A failure to locate the desired data within the custom connector suggests that the complication originates from Business Central.


A crucial aspect to grasp regarding the custom connector's test functionality is that observing data in the test results does not guarantee its transmission to your function in the canvas app. Discovering the absent data in these test outcomes often indicates potential issues with the custom connector's Swagger configuration. It's advisable to meticulously compare the Swagger documentation against the actual data output from Business Central to ensure consistency and accuracy.


Checking Postman


Utilizing an independent tool to verify the endpoint results is a wise strategy for ensuring data integrity and pinpointing issues. Postman stands out as a popular choice for this purpose, offering a robust platform to thoroughly investigate and diagnose potential discrepancies in the data returned from your endpoints.


The value of incorporating Postman into your debugging process extends beyond simple confirmation of results. It allows for a deeper dive into API behavior, facilitating the simulation of requests and the examination of responses in a controlled environment. This capability is invaluable for identifying subtle issues that might not be evident through direct inspection within your application or custom connector. Postman's comprehensive suite of features, including request history, variable environments, and pre-request scripts, enriches your debugging toolkit, providing clarity and insight into the intricate dynamics of your API interactions. Adopting Postman for endpoint verification not only bolsters your confidence in the data's accuracy but also enhances your ability to swiftly and effectively address any anomalies encountered.


Conclusion


Embarking on the journey of API integration within Microsoft Business Central and extending these capabilities to your canvas app through a custom connector is a venture filled with complexities and learning curves. Throughout this blog, we've navigated the nuanced path of debugging and pinpointing failure points that can impede the seamless flow of data—critical challenges that demand a developer's keen attention and analytical skills.


From the initial steps of verifying screen object associations in your canvas app to the intricate examination of your custom connector and the utilization of external tools like Postman, we've covered a comprehensive approach to ensure the integrity and reliability of your data flow. These methodologies, though detailed, underscore the importance of a structured and methodical troubleshooting process in overcoming the obstacles that might arise in API integration projects.


The insights shared here aim not just to guide you through identifying and rectifying issues but also to empower you with the confidence to tackle the inevitable challenges that come with integrating complex systems. The journey of debugging and ensuring data integrity is ongoing, but with the right tools and approaches, it becomes a manageable and enlightening part of your development experience.


Remember, the key to successful API integration lies in persistence, detailed inspection, and the willingness to leverage both internal and external resources to achieve clarity and resolution. As you continue to refine your skills and knowledge in this area, you'll find that the labyrinth of API integration becomes less daunting, leading to more efficient, reliable, and rewarding outcomes for your projects. Let this guide serve as a beacon through your integration challenges, illuminating the path to seamless connectivity and robust app performance. Happy debugging, and here's to the countless successful integrations that lie ahead in your developer journey.



13 views0 comments
bottom of page