Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

CRM 2011 Add JScript into Button Event JScript

0 comments


Problem:
I created a custom ribbon button. The button added with onclick event function eg. GenerateNumbering.
The problem is i need to add another Javascript as Ref toward another javascript.
I used Visual Ribbon Editor to edit and create the custom button and only one Javascript can be insert into it.
That mean i cant call another javascript as reference.

Solution:
I Created a solution with the entity that i need to customize the ribbon button.
Export out the solution and edit the customization by adding in some javascript to call.
Eg.

Editing the xml in these section


<CommandDefinition Id="vwork.SubGrid.vw_outlet.MainTab.Layout.GenerateRoute.Command">
<EnableRules />
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="isNaN" Library="$webresource:YourScriptName" />
<JavaScriptFunction FunctionName="isNaN" Library="$webresource:YourScriptName" />
<JavaScriptFunction FunctionName="isNaN" Library="$webresource:YourScriptName" />
<JavaScriptFunction Library="$webresource:YourScriptName" FunctionName="GenerateNumbering"/>
</Actions>
</CommandDefinition>

Save the customization xml, zipped it and import it back to the organization.
You can now call different function in other javascript u included above.

Thanks.
Hope my solution helps

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