Example 1
The following code example uses the launcher page objects and exhibits updating the entity, data validation and also canceling the operation.
var customizationHelper = new window.top.Customization();
function onLoad()
{
// update launch page GUI
var entity = customizationHelper.GetEntity();
if ((entity.EntityType == "CustomAttribute") &&
(entity.Name == "Location") &&
(entity.ValueType == "Text"))
{
var textbox = document.getElementById("txtValue");
textbox.value = entity.Value;
// can go to server here in order to populate
// the page with data
}
}
function Close()
{
var entity = customizationHelper.GetEntity();
var textbox = document.getElementById("txtValue");
// data validation
if ((entity.Name == "Location") &&
(textbox.Value.indexOf("Home") != -1))
{
alert ("Home is not allowed as location!");
}
else
{
// update entity before sending back to OG
entity.Value = textbox.value;
customizationHelper.Close();
}
}
function Cancel()
{
// close the launch page and don’t update entity
customizationHelper.Cancel();
}
Example 2
The following code example uses the launcher page objects.
var customizationHelper = new window.top.Customization();
function exploreEntityContextData()
{
var entity = customizationHelper.GetEntity();
if(entity.contextData)
{
var contextData = entity.contextData;
if(contextData.Contract)
{
var contract = contextData.Contract;
var info = "";
info += writeInfoItem("Type", contract.Type);
info += writeInfoItem("ContractName", contract.Name);
info += writeInfoItem("ContractType", contract.ContractType);
info += writeInfoItem("ContractTypeName", contract.ContractTypeName);
info += writeInfoItem("ContractVersionID", contract.ContractVersionID);
info += writeInfoItem("ContractPartyReceiverName", contract.ContractPartyReceiverName);
info += writeInfoItem("ContractPartyProviderName", contract.ContractPartyProviderName);
contractInfo.innerHTML = info;
}
}
}
function writeInfoItem(fieldName, value)
{
return "<b>" + fieldName + ":</b> " + value + "<br>";
}
| Copyright © 2012 CA. Alle Rechte vorbehalten. | Senden Sie CA Technologies eine E-Mail zu diesem Thema. |