diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 2a2050f..6e839c0 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -733,7 +733,7 @@ namespace AyaNova.PlugIn.V8 - private async System.Threading.Tasks.Task> ExportCustomFieldSchema(string objectName, string RavenCustomTranslationKeyObjectName=null) + private async System.Threading.Tasks.Task> ExportCustomFieldSchema(string objectName, string RavenCustomTranslationKeyObjectName = null) { var ret = new List(); if (RavenCustomTranslationKeyObjectName == null) RavenCustomTranslationKeyObjectName = objectName;//i.e. WidgetCustom1, WidgetCustom2 etc @@ -742,10 +742,10 @@ namespace AyaNova.PlugIn.V8 //is there customizations designated for this object? ObjectCustomFields ocf = ObjectCustomFields.GetItems(objectName); - if (ocf.Count == 0) + if (ocf.Count == 0) return ret; - - + + dynamic d = new JObject(); d.formkey = RavenCustomTranslationKeyObjectName; dynamic dtemplate = new JArray(); @@ -757,11 +757,11 @@ namespace AyaNova.PlugIn.V8 { bAtLeastOneFieldIsVisible = true; ret.Add(f.FieldName); - int n=Convert.ToInt32(f.FieldName.Replace("Custom", ""))+1;//raven custom fields are 1 based, v7 are zero based + int n = Convert.ToInt32(f.FieldName.Replace("Custom", "")) + 1;//raven custom fields are 1 based, v7 are zero based CustomFieldLocaleKeys.Add(RavenCustomTranslationKeyObjectName + n.ToString(), util.LocaleText.GetLocalizedText(objectName + ".Label." + f.FieldName)); dynamic dt = new JObject(); - dt.fld = RavenCustomTranslationKeyObjectName+"Custom"+n.ToString(); + dt.fld = RavenCustomTranslationKeyObjectName + "Custom" + n.ToString(); dt.hide = false; dt.required = true; switch (f.FieldType) @@ -789,23 +789,21 @@ namespace AyaNova.PlugIn.V8 break; default: dt.type = util.AyaUiFieldDataType.Text; - - + break; } - dt.type = AyaUiFieldDataType.Text; + dtemplate.Add(dt); - + } } - if (!bAtLeastOneFieldIsVisible) + if (!bAtLeastOneFieldIsVisible) return ret; - + //ok, were here because there *are* custom fields available - - - - + var a = await util.GetAsync("FormCustom/" + RavenCustomTranslationKeyObjectName); + var ctoken = util.CTokenFromResponse(a); + await util.PutAsync("FormCustom/" + RavenCustomTranslationKeyObjectName, d.ToString()); return ret; }