How to Add New Record from Subgrid in Dynamics CRM with Easyrepro

926 views Asked by At

Does anyone know how to add a new record from subgrid in dynamics CRM with Easyrepro?

xrmApp.Entity.SubGrid.ClickCommand("subGridName", "button", null, null);

I used this line but it gives me an error saying no command of this name exists.

I just need to click the Add New button on the subgrid.

2

There are 2 answers

0
Sharique Khan On BEST ANSWER

I found a custom way to do it as the Easyrepro team didn't make a built-in method for this.

I would search the button from its text and click on it as shown below.

Make sure the target window is the main window

var xrmBrowser = client.Browser;
var win = xrmBrowser.Driver.SwitchTo().Window(xrmBrowser.Driver.CurrentWindowHandle);

Find the button, let's say the button name is 'New Message' with its text and click on it.

win.FindElement(By.XPath("//*[text()='New Message']")).Click();
0
EasyReproLearner On
xrmApp.Entity.ClickSubgridAddButton("subGridName");