RE: Need to cancel particular record or fetch subgrid row id.
Hi,
The links I shared above has the code snippet for getting the selected row and id.
Extract from the link-
-------------
//Get an array of entity references for all selected rows in the subgrid
var selectedEntityReferences = [];
var selectedRows = Xrm.Page.getControl("Contacts").getGrid().getSelectedRows();
selectedRows.forEach(function (selectedRow, i) {
selectedEntityReferences.push(selectedRow.getData().getEntity().getEntityReference());
});
---------------
You need to work out how to change this as per your requirement. I would suggest go with the basics by
1) Writing the JS code to select the the row guid and displaying alert for it.
2) Use rest builder to get the JS code to cancel the case by hard coding the guid
3) Then merge the above two code i.e. get the guid from the (1) and then pass it on (2).
Regarding Rest builder, it is very easy to use. You need to
1) download & install the managed solution. Once it is installed, it will appear when you navigate to Settings >> Solutions >> {as the command bar button at top named 'CRM Rest Builder'} (it not refresh the page).
2) Click on the button, this will open the tool.
3) There you select the values as per the below screenshot [Web API, Update, ID of teh case to update etc) and click Create request.
4) When you click on create request, you will get the exact code to be used. (You then later need to update the pass the GUid as parameter instead if hard coding)
5) You can also click Execute request which will execute the request and cancel the case you have selected the guid for.
Hope this helps.