Answered by:
Sample Html Web resource

Question
-
I need to access some fields from my entity in a HTML webresource, the fields that are being passed are typename, type, id, orgname, userlcid, orglcid and the oprional data parameter, but i'm unable to fill the data parameter with values from exiting fields, can you please adviseTuesday, April 26, 2011 1:49 PM
Answers
-
I wrote a blogpost on how to manually determine the HTML in Jscript for a webresource (and immediately have it be in an iframe on the form) in an onload jscript. You could easily modify the html to include your form fields.
http://mileyja.blogspot.com/2011/03/set-html-rendered-within-iframe-in-crm.html
If you are using your web resource in another application you could just update the info in the web resource on update in a plugin also
http://mileyja.blogspot.com/2011/03/editing-embedded-web-resource-contents.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:07 PM
- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:07 PM
Tuesday, April 26, 2011 4:04 PMModerator -
DOM can be used for parsing the XML elements in a supported manner. You aren't grabbing page elements using the DOM parser, for that you use the XRM.page syntax, I am not using document.getElementByID. This solution is supported.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:08 PM
Tuesday, April 26, 2011 4:14 PMModerator -
it is undefined in side the web resource. You need to gather your attribute values from the CRM form and parse them into the update request or into the html you use to feed your update request. You will see where I am setting my HTML for the web resource in the jscript. You need to parse the values into there.
var strContentHTML = "<html><body><h1>HELLO WORLD!!<h1></body</html>";
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:08 PM
Tuesday, April 26, 2011 4:30 PMModerator
All replies
-
I wrote a blogpost on how to manually determine the HTML in Jscript for a webresource (and immediately have it be in an iframe on the form) in an onload jscript. You could easily modify the html to include your form fields.
http://mileyja.blogspot.com/2011/03/set-html-rendered-within-iframe-in-crm.html
If you are using your web resource in another application you could just update the info in the web resource on update in a plugin also
http://mileyja.blogspot.com/2011/03/editing-embedded-web-resource-contents.html
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:07 PM
- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:07 PM
Tuesday, April 26, 2011 4:04 PMModerator -
Isn't there a way without using the WCF service, i'm using the DOM (document.getElementByID) but i know it's not supported, so i'd rather use a supported methodTuesday, April 26, 2011 4:09 PM
-
DOM can be used for parsing the XML elements in a supported manner. You aren't grabbing page elements using the DOM parser, for that you use the XRM.page syntax, I am not using document.getElementByID. This solution is supported.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:08 PM
Tuesday, April 26, 2011 4:14 PMModerator -
from inside of the Html web resource the Xrm is not available, gives me undefined
Tuesday, April 26, 2011 4:15 PM -
it is undefined in side the web resource. You need to gather your attribute values from the CRM form and parse them into the update request or into the html you use to feed your update request. You will see where I am setting my HTML for the web resource in the jscript. You need to parse the values into there.
var strContentHTML = "<html><body><h1>HELLO WORLD!!<h1></body</html>";
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by Jamie MileyModerator Wednesday, May 16, 2012 2:08 PM
Tuesday, April 26, 2011 4:30 PMModerator -
I don't want to have to do manual parsing, I want to use the parameters and pass the data directly. is this possible?Tuesday, April 26, 2011 4:36 PM
-
I haven't checked. You should look into that. Let me know how to do it if you figure it out.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!Tuesday, April 26, 2011 5:13 PMModerator