In the previous blog, we tackled the hurdle of bypassing MFA using saved authentication states. While getting past the login screen is a victory, the real challenge in Dynamics 365 (D365) lies in the UI interaction with a few fields.
Unlike standard web forms, D365 relies heavily on asynchronous components. If your script doesn’t respect the interaction sequence of the CRM, your automation will be brittle and prone to false negatives.
In a recent project, we deployed a suite of 50 test cases to a CI/CD pipeline. Locally, everything passed. But in the cloud, nearly 30% failed. The culprit wasn’t the code logic; it was the Lookup fields.
The automation was “typing” data faster than the CRM’s background search could populate the suggestion menu. Because the script moved to the next step before the record was actually linked, the form was submitted with empty fields. This is a common pitfall: treating a complex CRM component like a simple text box. To fix this, we have to align our code with the component’s internal event triggers.
1. Handling Complex D365 Components
A. The Lookup Interaction Sequence
A Lookup field (like Account or Contact) is a multi-step process. You must click to focus, type to trigger the search event, and then select the result from the dynamically generated list explicitly.
Let us continue with the same example of creating a “Contact” through Playwright. Using Lookup and Option set fields. The handling of these fields is different as whenever you click on these fields the main form focus changes to the lookup panel or option set panel... Read More