Before you create a Web applet in Oracle CRM On Demand, carefully consider how you will use parameter field variables such as %%%User Id%%%, if the field contains characters that can be escaped as character entity references.
When you insert parameter field variables in HTML, characters in the field name like & are escaped as the corresponding character entity reference, (in this case &) and the browser expands the entity reference so that the referenced character is displayed. For example, you might want to create a homepage HTML Web applet with the company name: A&B Manufacturing. From the User and System Fields drop-down list, you can choose Company Name to insert the variable: %%%Company name%%% and at run time, this variable has the value A&B Manufacturing, which appears in the browser as A&B Manufacturing. However, character entity references are not expanded in JavaScript code, so in this case, put the variable in a referenceable context, retrieve it from the document DOM, then encode it as necessary. These differences are illustrated in the following example of Web Applet HTML code:
<span id=”companyname” style=”display:none” data-value=”%%%Company name%%%”></span>
<script type=”text/javascript”>
var var1 = ”%%%Company name%%%”;
var var2 = document.getElementById(“companyname”).getAttribute(“data-value”);
</script>
The value of var1 is “A&B Manufacturing” and the value of var2 is “A&B Manufacturing”. The values of var1 and var2 are different because the browser expands entity references in HTML tags and data, but not within the <script> element.
Select an option from the User and System Fields drop-down list to add parameter fields to the URL field at the current position of the cursor.
For example, if you choose User id from the drop-down list, %%%User id%%% is inserted. At run time, this parameter is replaced with the user ID of the user who is signed in.
As another example, if you choose Host Name from the list, %%%Hostname%%% is inserted at the cursor position. At run-time, this parameter is replaced with the host name of the server where Oracle CRM On Demand is running. This is useful in configurations containing a URL to Oracle CRM On Demand as it is no longer necessary to manually modify the Oracle CRM On Demand host name when migrating from one environment to another.
For more information, see User and System Fields.
|