CRM 2011 Retrieve Related Record SelectedID from SubGrid

0 comments


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

CRM 2011 Refreshing a Web Resource/Webpage On A Form

0 comments


I have problem with refreshing a custom webpage.
Below will be the function i use to refresh the webpage on particular trigger point.

var someOnchangeEvent = function(){
    var wrControl = Xrm.Page.ui.controls.get("nameofwebresoucecontrol");
    wrControl.setSrc(wrControl.getSrc());
}

CRM 2011 Get Organization ID

0 comments


Using SQL Server Management Studio.

Create new query as below:

Select * from MSCRM_CONFIG..Organization

CRM 2011 Get Dropdown Value/ Dropdown Text

0 comments


Below is the script to retrieve dropdown value and text.

To get text

Xrm.Page.data.entity.attributes.get("vw_facilitiestype").getSelectedOption().text
Xrm.Page.data.entity.attributes.get("vw_facilitiestype").getText()

To get value
Xrm.Page.data.entity.attributes.get("vw_facilitiestype").getSelectedOption().value
Xrm.Page.data.entity.attributes.get("vw_facilitiestype").getValue();