I found warning mark Line 77,88 and 123.
looks these line grammar is incorrect.. but I'm not professional of Java script.
I'm checking them now.
--------------------<below is CE_LinkManufacturer code>---------
//Get settings for 'Manufacturer'
var formattedSettingsItm = new Item('ItemType', 'CE_GetFormattedSettings');
formattedSettingsItm.setProperty('cloud_itemtype', 'Manufacturer');
formattedSettingsItm = formattedSettingsItm.apply();
if (formattedSettingsItm.isError())
{
top.aras.AlertError('Unable to get formatted settings for "Manufacturer" cloud type: ' + formattedSettingsItm.getErrorString());
return;
}
var propertyMappingItm = formattedSettingsItm.getItemsByXPath('Relationships/Item[@type="Property Mapping"]');
var manufacturerItemTypeName = formattedSettingsItm.getPropertyAttribute('local_itemtype', 'name');
var manufacturerCeObjectIdPropertyName = propertyMappingItm.getPropertyAttribute('ce_object_id', 'name');
var manufacturerCeSourcePropertyName = propertyMappingItm.getPropertyAttribute('ce_source', 'name');
var manufacturerCeSyncDatePropertyName = propertyMappingItm.getPropertyAttribute('ce_sync_date', 'name');
var manufacturerManufacturerNamePropertyName = propertyMappingItm.getPropertyAttribute('mfr_name_1', 'name');
var manufacturerCeManufacturerNamePropertyName = propertyMappingItm.getPropertyAttribute('mfr_name_2', 'name');
var isMainGrid = (typeof(parent.itemTypeName) === 'undefined');
var aWindow = top.aras.getMostTopWindowWithAras(window);
if (aras.commonProperties && aras.commonProperties.SearchCountModeException) {
aras.commonProperties.SearchCountModeException.push('03278E95AFE34B7EA0B352EAA85AE021');
}
var args = {
aras: aras,
type: 'SearchDialog',
dialogWidth: 700,
dialogHeight: 450,
itemtypeName: 'CE_CloudManufacturer'
};
var dialog = (aWindow.main || aWindow).ArasModules.MaximazableDialog.show('iframe', args);
dialog.promise.then(callback);
//Add 'gridLinkClick' event handler
var intervalId = setInterval(function() {
try
{
var contentWindow = dialog.dialogNode.childNodes[1].childNodes[0].contentWindow;
var grid = contentWindow.grid || contentWindow.gridApplet;
if ((typeof(grid) !== 'undefined') && (grid !== null))
{
clearInterval(intervalId);
dojo.connect(grid, 'gridLinkClick', onGridLinkClickEventHandler);
}
}
catch(e)
{
}
}, 300);
function callback(res)
{
if (aras.commonProperties && aras.commonProperties.SearchCountModeException) {
aras.commonProperties.SearchCountModeException.pop();
}
if (isNullOrUndefined(res)) {
return;
}
var item = res.item;
if (!isNullOrUndefined(item))
{
//Get item from cache or from server
var manufacturerId = aras.getVariable('CE_CurrentItemId', '');
var manufacturerItm = aras.getItemById(manufacturerItemTypeName, manufacturerId, 0);
if (!isNullOrUndefined(manufacturerItm))
{
var objectId = top.aras.getItemProperty(manufacturerItm, manufacturerCeObjectIdPropertyName, '');
if (objectId !== '')
{
var res = top.aras.confirm(manufacturerItemTypeName + ' is already linked. Are you sure you want to overwrite the link?');
if (!res) {
return;
}
}
var localManufacturerName = top.aras.getItemProperty(manufacturerItm, manufacturerManufacturerNamePropertyName, '');
var cloudManufacturerObjectId = top.aras.getItemProperty(item, 'mfr_object_id', '');
var cloudManufacturerName = top.aras.getItemProperty(item, 'mfr_name', '');
var cloudCeSource = '1';
top.aras.setItemProperty(manufacturerItm, manufacturerCeObjectIdPropertyName, cloudManufacturerObjectId);
if (localManufacturerName == '')
{
top.aras.setItemProperty(manufacturerItm, manufacturerManufacturerNamePropertyName, cloudManufacturerName);
}
top.aras.setItemProperty(manufacturerItm, manufacturerCeManufacturerNamePropertyName, cloudManufacturerName);
top.aras.setItemProperty(manufacturerItm, manufacturerCeSourcePropertyName, cloudCeSource);
top.aras.setItemProperty(manufacturerItm, manufacturerCeSyncDatePropertyName, '');
if (!isMainGrid)
{
//Update form
aras.RefillWindow(parent.item, parent, true);
} else {
//Update MainGrid
aWindow.main.work.searchContainer.runSearch();
}
}
}
}
function onGridLinkClickEventHandler(str)
{
try
{
var link = (str.split(',')[1]).replace(/'/g, '');
window.open(link, '_blank');
}
catch(e)
{
return;
}
}
function isNullOrUndefined(param)
{
return ((typeof(param) === 'undefined') || (param == null));
}