CRM 2011 Retrieve Related Record SelectedID from SubGrid


Problem: 
How to retrieve the selected record from related entities subgrid ?
I wan to use a button to get all the selected record id.

Solve Method:
1. Create one button to call java script upon clicked.
eg.

function GenerateRoute(AllSelectedId) { debugger; var Answer = AllSelectedId; }

2. Import and export out solution and modify the solution customization.
Adding "<CrmParameter Value="SelectedControlSelectedItemIds" /> " under Javascript XML.


<Actions>
<JavaScriptFunction Library="$webresource:Route.js" FunctionName="Generate" >
<CrmParameter Value="SelectedControlSelectedItemIds" /> 
</JavaScriptFunction> 
</Actions>

3. Import back the zipped solution. And test run by selecting the particular record.

4. Final Generate and get the result. All the selected record from related entities subgrid are retrieve.

eg Javascript function
function Generate(AllSelectedId) { }

all the selected id will populate into AllSelectedId as array.

Thanks. Hope my solution helps

0 comments: