CRM 2011 Web Resources RRS feed

  • Question

  • I've been asking a few questions the past week as I work through doing custom CRM HTML/JavaScript forms that I am launching from ribbon buttons. What my issue is, is that I have some complicated dialogs that cannot do everything I need them to do, one of which is migrating a lead to a contact and bring over various bit fields.  For example, we have a Boolean field on the lead that is an email marketing opt-in field.  Since the create record logic in the dialog cannot read a bit field from the lead and map it to a bit field in the contact record, I have to build HTML pages instead of dialogs.  There's about another dozen or so issues like this that have forced me to sit aside the dialogs for custom HTML pages.

    But I am running into a few issues that are not easy to resolve. So I want to list them here and see if I can get some ideas or maybe a couple of snippets of code to help me wrap up some of these issues, as I think my biggest struggle is just figuring out how to do some things in JavaScript that are not obvious until you have seen it once or twice. 

    I've been working through coding each control and feature that you might need on an HTML page but I have ran into a few issues.  It is VERY slow going because I cannot find solid working samples.  So I am running out of time and those above me are getting frustrated.  So I want to get some ideas from others.  Maybe samples, suggestions, or just point me in the direction.

    Here's where I am having issues:

    1. Call the "Lookup Record" form from JavaScript

    I can call it, but I cannot size it correctly using the window dialog function in JavaScript.  It always collapses down to only show the first sentence at the top.  I can pass in height and width but they are ignored.  However, I can call another HTML page using the same code, and it works fine.  So something is unique with the "Lookup Record" form in that it apparently is resizing itself somehow, but doing it wrong.  Our user's have report similar issues in Outlook with this form.  Is anyone doing this with IE9 and HTML/JavaScript web resources?  Maybe an IE9 issue?  Compatibility mode issue?  However, it works fine when I call it directly via the URL.  Just doesn't work well call it via window.open, dialog, or modal in JavaScript.

    2. I am trying to fill a dropdown list (HTML Select) from my JavaScript.  I have a custom entity that has a name field.  I want my dropdown list to contain a list of names.  When the user selects it, I want to then hit the CRM db via REST/JQuery.  I've coded a JavaScript function to hit CRM db via REST/JQuery but I am struggling with the syntax to correctly call it and loop through the returned items to load the dropdown list.  This seems like a rather common need so I am hoping there's a standard approach that works well for this that someone could share with me. 

    3. I need to figure out if I can use the email templates to create a send an email via JavaScript.  I have not looked into this yet. Is that possible?  Can my custom HTML page run through a process and use an existing template in CRM to create and send an email?  I'd like to just have the ability to load the template, update the merged/tagged fields, and send the email.  

    4. I'm wondering if at this point, I should move over to creating a plugin and not just HTML/JavaScript web resources.  99% of my struggles is figuring out to do this stuff in JavaScript.  Maybe if I was back in C# and .Net I would have much better luck in resolving issues as I run into them.  Also, it seems logical that if I am hitting the CRM db, maybe a plugin would make sure sense that trying to code all of this up in JavaScript.  If this was an ASPX project, I would never consider hitting the db in JavaScript and would only do so via a separate data layer class library and/or a web service.  So maybe it makes more sense to move anything that hits the DB back into a plugin.  Are there any standard approaches here that others have found useful and would recommend?

    Any thoughts, suggestions, etc. are much appreciated.

    Best regards,

    Jon Rothlander


    Jon Rothlander

    Tuesday, February 25, 2014 4:44 AM