A customer had the requirement to incorporate an HTML page within Sage CRM.
This article explains how to structure an ASP page within Sage CRM allow 3rd party HTML to be included with the page and maintain the menu and navigation of Sage CRM.
The Custom Page has been added in to the Case Menu.
This is the normal way in which an ASP page is called. The action is "Customfile" and in my example I am calling a file called "testhtmlpage.asp". This is in the folder
C:\Program Files (x86)\Sage\CRM\CRM\WWWRoot\CustomPages
But it could be placed in subfolder.
The code of the ASP page will provide the heading and styling for the included HTML file.
<!-- #include file ="sagecrm.js"--> <!-- Typical ASP Page Structure (Try - Catch) --> <% //FileBlock Object Properties var fileBlock = CRM.GetBlock("file"); fileBlock.FileName = "testHTMLpage.html"; //if the Translate property is set to true will search for myFile_UK, myFile_DE, etc depending on users language fileBlock.Translate = false //ProperCase applies propercase formatting to the text; //fileBlock.Propercase = true //default path is C:\Program Files (x86)\Sage\CRM\CRM\WWWRoot\Reports\ fileBlock.DirectoryPath ="C:\\Program Files (x86)\\Sage\\CRM\\CRM\\WWWRoot\\CustomPages" //Block to Web - Preferred //Arg is either Argument (whereclause) or Record object depending on block type used. //Remove Arg if no parameter is being passed. CRM.AddContent(fileBlock.Execute()); //use default tab group - ensure any CRM.GetTabs() is commented out Response.Write(CRM.GetPage()); //specify a tab group //Response.Write(CRM.GetPage("TabGroupName")); %>
This technique uses the fileblock object. See: CRMFileBlock object (sagecrm.com)
I have named the file to be included and provided the path to the file. This is also within the CustomPages folder.
The include file and the CRM objects in the code above are responsible for building the page that makes it look like part of the Sage CRM interface. They will build the topcontent and menus.
The file to be included must not contain HTML, Header, Body, or Style tags that conflict with the tags provided by the ASP objects.
My example file to be included is "TestHTMLPage.html".
<header> <h1>Markup Languages Features</h1> </header> <main> <section> <h2>Headings and Paragraphs</h2> <p>This is a paragraph. HTML allows you to structure your content with different heading levels and paragraphs to create a well-organized document.</p> </section> <section> <h2>Lists</h2> <h3>Ordered List</h3> <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol> <h3>Unordered List</h3> <ul> <li>First item</li> <li>Second item</li> <li>Third item</li> </ul> </section> <section> <h2>Links and Images</h2> <p>Here is a link to <a href="https://www.example.com" target="_blank">Example.com</a>.</p> <p>Here is an image:</p> <img src="http://localhost/crm/Themes/img/ergonomic/Icons/green/card.svg" alt="Placeholder Image"> </section> <section> <h2>Tables</h2> <table> <thead> <tr> <th>Header 1</th> <th>Header 2</th> <th>Header 3</th> </tr> </thead> <tbody> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> <td>Row 1, Cell 3</td> </tr> <tr> <td>Row 2, Cell 1</td> <td>Row 2, Cell 2</td> <td>Row 2, Cell 3</td> </tr> </tbody> </table> </section> <section> <h2>Forms</h2> <form action="#" method="post"> <div> <label for="name">Name:</label> <input type="text" id="name" name="name"> </div> <div> <label for="email">Email:</label> <input type="email" id="email" name="email"> </div> <div> <label for="message">Message:</label> <textarea id="message" name="message"></textarea> </div> <div> <button type="submit">Submit</button> </div> </form> </section> </main> <footer> <p>© 2024 Markup Languages Tutorial</p> </footer>