Dynamics 365 CRM users can have access to EasyRepro’s test automation functionality. It provides automatic testing and interactions with the CRM Microsoft Dynamics 365 user interface. But in the case of Business Process Flow (BPF), it only works up until the BPF stage’s dialogue box is usable, as seen below:
But what if you wish to proceed to the Next Stage, the Previous Stage, or finish the BPF for the record instead?
In this article, you will find the response to your query. In addition, we’ll provide you with a general function in the dialogue box to carry out any BPF activities right here.
Let’s use the opportunity record as a business process flow example. We are now at the Qualify stage and want to go on to the next step, which is Develop. Again, we will utilize our generic function to do this.
Let’s now invoke our function. In this case, four justifications support our desire to access the Qualify stage and go on to the Develop stage by selecting the Next Stage button. For executing EasyRepro methods, the other two are XrmApp and WebClient.
To Know:
Both XrmApp and WebClient, which are classes of EasyRepro, are known as the useApp and clientWeb.
PerformBPFaction(“Qualify”, “Next Stage”, useApp , clientWeb);
The output of the mentioned function can be seen in the image below after invoking it. It has moved on to the Develop stage.
The Pop-Up dialogue window will shut if we call our function and add the second argument as “Close.” Here, we need to shut the dialogue box for the “Develop” stage.
PerformBPFaction(“Develop”, “Close”, useApp, clientWeb);
We can see that the dialogue window, which was previously open, has been closed by using the above function.
The use of this general function allows us to do a variety of tasks, including “Set Active,” “Finish,” “Back ,” and “Pin the stage flyout.”
Let’s now explore the generic function.
You can test that you are on your main window, where the Business Process Flow is present, by applying the first two lines below.
var myBrowser = clientWeb.Browser;
var appWindow = myBrowser.Driver.SwitchTo().Window(myBrowser.Driver.CurrentWindowHandle);
It will pick the stage and show the dialogue box in the following sentence. The stage name which you want to view is ‘stageSelect’ in this example.
useApp.BusinessProcessFlow.SelectStage(stageSelect);
We identify the button to click by utilising XPath. According to our example, its oppBPFButton will be Next Stage as we wish to click the Next Stage button. After locating the button, we use the Click() function to click it.
appWindow .FindElement(By.XPath(“//button[@title=’”+oppBPFButton +”‘]”)).Click();
Your action will be carried out when the click method has been used, according to the provided inputs.
Common Method:
private void InitiateBPFActions(string stageSelect, string oppBPFButton , XrmApp useApp , WebClient clientWeb)
{
var myBrowser = clientWeb.Browser;
var appWindow = myBrowser.Driver.SwitchTo().Window(myBrowser.Driver.CurrentWindowHandle);
try
{
useApp.BusinessProcessFlow.SelectStage(stageSelect);
appWindow.FindElement(By.XPath(“//button[@title='”+oppBPFButton +”‘]”)).Click();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
Result:
Using EasyRepro, the mentioned common function will allow you to perform a wide range of operations on the Dynamics 365 CRM Business Process Flow.