CRM 2011 Refresh Webpage

0 comments


.eg Javascript

var wrControl = Xrm.Page.ui.controls.get("Webresource_WebpageName");
wrControl.setSrc(wrControl.getSrc());

CRM 2011 Refresh SubGrid

0 comments


eg. Javascript

gridControl = Xrm.Page.ui.controls.get("SubGrid_Name");
gridControl.refresh();


CRM 2011 Button To Open New Page

0 comments


Problem:
How do i write html in javascript and open the webpage.

Solution:
eg. Javascript


function newPage(){
var newWin = open('url','_blank','fullscreen=yes,directories=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes­,resizable=yes');
newWin.document.open();
newWin.document.write('<HTML>');
newWin.document.write('<HEAD>');
newWin.document.write('<style type="text/css">');
    newWin.document.write('#map {');
    newWin.document.write('height: 100%;');
    newWin.document.write('width: 100%;');
    newWin.document.write('border: 1px solid #000;');
    newWin.document.write('}');
    newWin.document.write('</style>');
newWin.document.write('</HEAD>');
newWin.document.write('<BODY>');
newWin.document.write('<iframe id="map" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.com&amp;output=embed"></iframe>');
newWin.document.write('</BODY>');
newWin.document.write('</HTML>');
newWin.document.close();
}

Call these function under any trigger point. As for me i used it under onclick event from a button.

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