Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Rabbits don't follow orders

    Posted on April 29th, 2007 mitch Print Print No comments

    My friend Bruce W. dropped off some supplies at my house this evening and when I went out to get them, I found one of my highly-trained attack rabbits setting on the front lawn.

    "Attack," I ordered.  But, it just set there like a brown, furry, lawn ornament.

    I guess I should have believed the guy at the attack rabbit training school….

    Meanderings
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    1,649 views
  • JavaScript: How to Close Browser Window (window.close()) Without Warning

    Posted on April 29th, 2007 mitch Print Print 7 comments

    If you've ever tried to close a browser window from ASP.NET by using the following code:

     

    <input type="button" class="inputfields"
     onclick="javascript:window.close();" value="Close" /></td>

    You will probably receive the following message:

     

    After digging around for 20 minutes or so, I finally found the answer on Anatoly Lubarsky's blog:

     

    <input type="button" class="inputfields"
    onclick="javascript:window.opener='x';window.close();" value="Close" /></td>
    Customization, Development, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    8,343 views
  • Creating a legal filename in JavaScript

    Posted on April 29th, 2007 mitch Print Print No comments

    I am working on a project this weekend ( yeah, I know ) where I will be creating a folder in the file system based on the Account Name for an Account within CRM.  Since it is possible to have characters within an Account Name that would be invalid in a file or folder name, they must be replaced.

    The following JavaScript snippet will replace any invalid character within the Account Name with an underscore. 

    // Create a dummy account name for testing purposes.
    crmForm.all.name.DataValue = "this?is/\ a* test";
    
    if (crmForm.all.name != null)
    {
    	// The replaceChar should be either a space
    	// or an underscore.
    	var replaceChar = "_";
    	var regEx = new RegExp('[,/\:*?""<>|]', 'g');
    	var Filename = crmForm.all.name.DataValue.replace(regEx, replaceChar);
    
    	// Show me the new file name.
    	alert(Filename);
    }
    
    Customization, Development, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    2,022 views