application.ADF.scripts.loadJQuery(noConflict=true);
application.ADF.scripts.loadJQueryUI();
// Variable for the version of the field - Display in Props UI.
fieldVersion = "2.0.15";
// CS version and required Version variables
requiredCSversion = 10;
csVersion = ListFirst(ListLast(request.cp.productversion," "),".");
This Custom Field Type requires CommonSpot #requiredCSversion# or above.
// initialize some of the attributes variables
typeid = attributes.typeid;
prefix = attributes.prefix;
formname = attributes.formname;
formID = attributes.formID;
currentValues = attributes.currentValues;
// AjaxProxy Path to make ajax call in context of the site
ajaxComURL = application.ADF.ajaxProxy;
ajaxBeanName = 'customElementDataManager';
if( not structKeyExists(currentValues, "childCustomElement") )
currentValues.childCustomElement = "";
if( not structKeyExists(currentValues, "parentUniqueField") )
currentValues.parentUniqueField = "";
if( not structKeyExists(currentValues, "childUniqueField") )
currentValues.childUniqueField = "";
if( not structKeyExists(currentValues, "childLinkedField") )
currentValues.childLinkedField = "";
if( not structKeyExists(currentValues, "inactiveField") )
currentValues.inactiveField = "";
if( not structKeyExists(currentValues, "inactiveFieldValue") )
currentValues.inactiveFieldValue = "";
if( not structKeyExists(currentValues, "displayFields") )
currentValues.displayFields = "";
if( not structKeyExists(currentValues, "widthValue") )
currentValues.widthValue = "";
if( not structKeyExists(currentValues, "widthUnit") )
currentValues.widthUnit = "";
if( not structKeyExists(currentValues, "heightValue") )
currentValues.heightValue = "";
if( not structKeyExists(currentValues, "heightUnit") )
currentValues.heightUnit = "";
if( not structKeyExists(currentValues, "sortByType") )
currentValues.sortByType = "";
if( not structKeyExists(currentValues, "sortByField") )
currentValues.sortByField = "";
if( not structKeyExists(currentValues, "sortByDir") )
currentValues.sortByDir = "";
if( not structKeyExists(currentValues, "positionField") )
currentValues.positionField = "";
if( not structKeyExists(currentValues, "assocCustomElement") )
currentValues.assocCustomElement = "";
if( not structKeyExists(currentValues, "secondaryElementType") )
currentValues.secondaryElementType = "CustomElement";
if( not structKeyExists(currentValues, "interfaceOptions") )
currentValues.interfaceOptions = "existing,EditAssoc,delete";
if( not structKeyExists(currentValues, "compOverride") )
currentValues.compOverride = "";
if( not structKeyExists(currentValues, "parentInstanceIDField") )
currentValues.parentInstanceIDField = "";
if( not structKeyExists(currentValues, "childInstanceIDField") )
currentValues.childInstanceIDField = "";
if( not structKeyExists(currentValues, "newOptionText") )
currentValues.newOptionText = "";
if( not structKeyExists(currentValues, "existingOptionText") )
currentValues.existingOptionText = "";
if( not structKeyExists(currentValues, "editAssocOptionText") )
currentValues.editAssocOptionText = "";
if( not structKeyExists(currentValues, "editChildOptionText") )
currentValues.editChildOptionText = "";
if( not structKeyExists(currentValues, "deleteOptionText") )
currentValues.deleteOptionText = "";
if( not structKeyExists(currentValues, "passthroughParams") )
currentValues.passthroughParams = "";
// UI changed to provide the JOIN as a single field instead of child and assoc. So added logic to properly select the join and secondary elements according to the data stored for DB
joinObj = '';
secondaryObj = '';
if (IsNumeric(currentValues.assocCustomElement))
{
joinObj = currentValues.assocCustomElement;
secondaryObj = currentValues.childCustomElement;
}
else
joinObj = currentValues.childCustomElement;
if (NOT IsNumeric(currentValues.assocCustomElement))
{
if (ListFindNoCase(currentValues.interfaceOptions, 'new'))
{
currentValues.interfaceOptions = ListSetAt(currentValues.interfaceOptions, ListFindNoCase(currentValues.interfaceOptions,'new'), 'existing');
currentValues.existingOptionText = currentValues.newOptionText;
currentValues.newOptionText = "";
}
if (ListFindNoCase(currentValues.interfaceOptions, 'editChild'))
{
currentValues.interfaceOptions = ListSetAt(currentValues.interfaceOptions, ListFindNoCase(currentValues.interfaceOptions,'editChild'), 'editAssoc');
currentValues.editAssocOptionText = currentValues.editChildOptionText;
currentValues.editChildOptionText = "";
}
}
parentElementType = '';
parentFormLabel = '';
fieldsMethod = "getFields";
fieldsArgs = StructNew();
infoMethod = "getInfo";
infoArgs = StructNew();
isDataManagerEnabled = 1;
switch (dlgtype)
{
case 'customelement':
parentElementType = 'CustomElement';
infoArgs.elementID = formID;
fieldsArgs.elementID = formID;
break;
case 'metadata':
parentElementType = 'MetadataForm';
infoMethod = "getForms";
infoArgs.id = formID;
fieldsArgs.formID = formID;
break;
case 'simpleform':
isDataManagerEnabled = 0;
}
customElementObj = Server.CommonSpot.ObjectFactory.getObject('CustomElement');
metadataFormObj = Server.CommonSpot.ObjectFactory.getObject('MetadataForm');
if (parentElementType EQ 'MetadataForm')
parentFormObj = metadataFormObj;
else
parentFormObj = customElementObj;
allMetadataForms = metadataFormObj.getForms();
allCustomElements = customElementObj.getList(type="All", state="Active");
errorMsgCustom = 'Some error occurred while trying to perform the operation.';
if (parentElementType EQ 'MetadataForm')
parentFormLabel = parentFormDetails.formName;
else
parentFormLabel = parentFormDetails.Name;
SELECT ID, Name, LOWER(Type) AS Type
FROM allCustomElements
UNION ALL
SELECT ID, CAST(FormName AS VARCHAR) AS Name, 'metadataform' AS Type
FROM allMetadataForms
SELECT *
FROM allCustomElements
WHERE lower(Type) =
SELECT ID, Label AS Name
FROM selectedTypeFields
WHERE
Primary Object:
#parentFormLabel#
Joining Custom Element:
style="display:none;">
This is the custom element that contains the relationship between the object(s). It may contain other data as well.