OBJECT Codeunit 10000220 IS Json Interface Mgt. { OBJECT-PROPERTIES { Date=05.03.19; Time=15:00:00; Version List=NAVIS11.00; } PROPERTIES { OnRun=BEGIN END; } CODE { VAR Variables@1001 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; JSON@1000 : Text; [External] PROCEDURE Initialize@2(); VAR JSONMgt@1001 : Codeunit 5459; BEGIN WITH JSONMgt DO BEGIN InitializeEmptyCollection; JSON := WriteCollectionToString; InitializeEmptyObject; GetJSONObject(Variables); END; END; [External] PROCEDURE InitializeFromTempBlob@5(TempBlob@1000 : Record 99008535); VAR JSONMgt@1001 : Codeunit 5459; BEGIN JSON := TempBlob.ReadAsTextWithCRLFLineSeparator; WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF NOT GetJObjectFromCollectionByIndex(Variables,0) THEN BEGIN InitializeEmptyObject; GetJSONObject(Variables); END; END; END; [External] PROCEDURE AddRecordID@3(Variant@1000 : Variant); VAR JSONMgt@1004 : Codeunit 5459; DataTypeMgt@1005 : Codeunit 701; JsonObject@1002 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; RecRef@1001 : RecordRef; BEGIN IF NOT DataTypeMgt.GetRecordRef(Variant, RecRef) THEN EXIT; WITH JSONMgt DO BEGIN InitializeCollection(JSON); InitializeEmptyObject; GetJSONObject(JsonObject); AddJPropertyToJObject(JsonObject,'TableNo',RecRef.NUMBER); AddJPropertyToJObject(JsonObject,'TableName',RecRef.NAME); AddJPropertyToJObject(JsonObject,'RecordId',RecRef.RECORDID); AddJObjectToCollection(JsonObject); JSON := WriteCollectionToString; END; END; [External] PROCEDURE AddTempTable@4(TableName@1007 : Text;Variant@1000 : Variant); VAR JSONMgt@1004 : Codeunit 5459; DataTypeMgt@1006 : Codeunit 701; RecRef@1001 : RecordRef; JsonArray@1005 : DotNet "'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.Linq.JArray"; JsonObject@1002 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; TableView@1008 : Text; BEGIN IF NOT DataTypeMgt.GetRecordRef(Variant, RecRef) THEN EXIT; IF NOT RecRef.ISTEMPORARY THEN EXIT; TableView := RecRef.GETVIEW(FALSE); RecRef.RESET; WITH JSONMgt DO BEGIN InitializeEmptyCollection; GetJsonArray(JsonArray); IF RecRef.FINDSET THEN REPEAT InitializeEmptyObject; GetJSONObject(JsonObject); PopulateJsonFromAnyTable(RecRef,'',JsonObject); AddJObjectToJArray(JsonArray,JsonObject); UNTIL RecRef.NEXT = 0; InitializeCollection(JSON); InitializeEmptyObject; GetJSONObject(JsonObject); AddJPropertyToJObject(JsonObject,'TableNo',RecRef.NUMBER); AddJPropertyToJObject(JsonObject,'TableName',TableName); AddJPropertyToJObject(JsonObject,'TableView',TableView); AddJPropertyToJObject(JsonObject,'RecordId',RecRef.RECORDID); AddJArrayToJObject(JsonObject,'Records',JsonArray); AddJObjectToCollection(JsonObject); JSON := WriteCollectionToString; END; END; [External] PROCEDURE AddFilteredTable@18(TableName@1007 : Text;FieldNameFilter@1003 : Text;Variant@1000 : Variant); VAR JSONMgt@1004 : Codeunit 5459; DataTypeMgt@1006 : Codeunit 701; RecRef@1001 : RecordRef; JsonArray@1005 : DotNet "'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.Linq.JArray"; JsonObject@1002 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; TableView@1008 : Text; BEGIN IF NOT DataTypeMgt.GetRecordRef(Variant, RecRef) THEN EXIT; WITH JSONMgt DO BEGIN InitializeEmptyCollection; GetJsonArray(JsonArray); IF RecRef.FINDSET THEN REPEAT InitializeEmptyObject; GetJSONObject(JsonObject); PopulateJsonFromAnyTable(RecRef,FieldNameFilter,JsonObject); AddJObjectToJArray(JsonArray,JsonObject); UNTIL RecRef.NEXT = 0; InitializeCollection(JSON); InitializeEmptyObject; GetJSONObject(JsonObject); AddJPropertyToJObject(JsonObject,'TableNo',RecRef.NUMBER); AddJPropertyToJObject(JsonObject,'TableName',TableName); AddJArrayToJObject(JsonObject,'Records',JsonArray); AddJObjectToCollection(JsonObject); JSON := WriteCollectionToString; END; END; [External] PROCEDURE AddRecordFields@1(Variant@1000 : Variant); VAR JSONMgt@1004 : Codeunit 5459; DataTypeMgt@1006 : Codeunit 701; RecRef@1001 : RecordRef; JsonArray@1005 : DotNet "'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.Linq.JArray"; JsonObject@1002 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; BEGIN IF NOT DataTypeMgt.GetRecordRef(Variant, RecRef) THEN EXIT; WITH JSONMgt DO BEGIN InitializeEmptyCollection; GetJsonArray(JsonArray); InitializeEmptyObject; GetJSONObject(JsonObject); PopulateJsonFromAnyTable(RecRef,'',JsonObject); AddJObjectToJArray(JsonArray,JsonObject); InitializeCollection(JSON); InitializeEmptyObject; GetJSONObject(JsonObject); AddJPropertyToJObject(JsonObject,'TableNo',RecRef.NUMBER); AddJPropertyToJObject(JsonObject,'TableName',RecRef.NAME); AddJArrayToJObject(JsonObject,'Records',JsonArray); AddJObjectToCollection(JsonObject); JSON := WriteCollectionToString; END; END; [External] PROCEDURE AddVariable@21(VariableName@1000 : Text;Value@1003 : Variant); VAR JSONMgt@1002 : Codeunit 5459; BEGIN JSONMgt.AddJPropertyToJObject(Variables,VariableName,Value); END; [External] PROCEDURE AddEncryptedVariable@64(VariableName@1000 : Text;Value@1003 : Text); VAR JSONMgt@1002 : Codeunit 5459; EncryptionManagement@1008 : Codeunit 10000221; BEGIN JSONMgt.AddJPropertyToJObject(Variables,VariableName,EncryptionManagement.EncryptText(Value)); END; [External] PROCEDURE GetRecord@7(VAR RecRef@1001 : RecordRef) : Boolean; VAR JSONMgt@1005 : Codeunit 5459; JsonObject@1003 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; TempRecId@1002 : RecordID; TableRecordId@1000 : Text; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByPropertyValue(JsonObject,'TableName',RecRef.NAME) THEN IF GetStringPropertyValueFromJObjectByName(JsonObject,'RecordId',TableRecordId) THEN IF EVALUATE(TempRecId,TableRecordId) THEN BEGIN RecRef.GET(TempRecId); EXIT(TRUE); END; END; END; [External] PROCEDURE GetRecordByTableName@31(TableName@1004 : Text;VAR RecRef@1001 : RecordRef) : Boolean; VAR JSONMgt@1005 : Codeunit 5459; JsonObject@1003 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; TempRecId@1002 : RecordID; TableRecordId@1000 : Text; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByPropertyValue(JsonObject,'TableName',TableName) THEN IF GetStringPropertyValueFromJObjectByName(JsonObject,'RecordId',TableRecordId) THEN IF EVALUATE(TempRecId,TableRecordId) THEN BEGIN RecRef.GET(TempRecId); EXIT(TRUE); END; END; END; [External] PROCEDURE GetTempTable@10(TableName@1001 : Text;VAR RecRef@1000 : RecordRef) : Boolean; VAR JSONMgt@1004 : Codeunit 5459; JsonObject@1005 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; TempRecId@1009 : RecordID; JSONCollection@1002 : Text; TableView@1006 : Text; TableRecordId@1007 : Text; CollectionIndex@1003 : Integer; BEGIN IF NOT RecRef.ISTEMPORARY THEN EXIT; RecRef.RESET; RecRef.DELETEALL; WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByPropertyValue(JsonObject,'TableName',TableName) THEN BEGIN GetStringPropertyValueFromJObjectByName(JsonObject,'TableView',TableView); GetStringPropertyValueFromJObjectByName(JsonObject,'RecordId',TableRecordId); IF GetStringPropertyValueFromJObjectByName(JsonObject,'Records',JSONCollection) THEN BEGIN InitializeCollection(JSONCollection); FOR CollectionIndex := 1 TO GetCollectionCount DO BEGIN GetJObjectFromCollectionByIndex(JsonObject,CollectionIndex - 1); PopulateAnyTableFromJson(JsonObject,'',RecRef); RecRef.INSERT; END; END; END; END; RecRef.SETVIEW(TableView); IF EVALUATE(TempRecId,TableRecordId) THEN IF RecRef.GET(TempRecId) THEN; EXIT(NOT RecRef.ISEMPTY); END; [External] PROCEDURE UpdateFilteredTable@32(TableName@1001 : Text;KeyFieldName@1008 : Text;VAR RecRef@1000 : RecordRef) : Boolean; VAR JSONMgt@1004 : Codeunit 5459; DataTypeMgt@1002 : Codeunit 701; JsonArray@1006 : DotNet "'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.Linq.JArray"; JsonObject@1005 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; FldRef@1003 : FieldRef; JSONCollection@1007 : Text; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByPropertyValue(JsonObject,'TableName',TableName) THEN IF GetStringPropertyValueFromJObjectByName(JsonObject,'Records',JSONCollection) THEN BEGIN InitializeCollection(JSONCollection); IF RecRef.FINDSET THEN REPEAT IF DataTypeMgt.FindFieldByName(RecRef,FldRef,KeyFieldName) THEN BEGIN OnBeforeGetJObjectFromCollectionByPropertyValue(RecRef,KeyFieldName); IF GetJObjectFromCollectionByPropertyValue(JsonObject,RemoveNonAplhaNumericCharacters(KeyFieldName),FORMAT(FldRef.VALUE)) THEN BEGIN PopulateAnyTableFromJson(JsonObject,'',RecRef); RecRef.MODIFY; END; END; UNTIL RecRef.NEXT = 0; END; END; END; [External] PROCEDURE GetRecordFields@6(VAR RecRef@1000 : RecordRef) : Boolean; VAR JSONMgt@1004 : Codeunit 5459; JsonObject@1005 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"; JSONCollection@1001 : Text; CollectionIndex@1003 : Integer; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByPropertyValue(JsonObject,'TableName',RecRef.NAME) THEN IF GetStringPropertyValueFromJObjectByName(JsonObject,'Records',JSONCollection) THEN BEGIN InitializeCollection(JSONCollection); FOR CollectionIndex := 1 TO GetCollectionCount DO BEGIN GetJObjectFromCollectionByIndex(JsonObject,CollectionIndex - 1); PopulateAnyTableFromJson(JsonObject,'',RecRef); END; EXIT(TRUE); END; END; END; [External] PROCEDURE GetAsTempBlob@11(VAR TempBlob@1000 : Record 99008535); VAR JSONMgt@1001 : Codeunit 5459; JArray@1002 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JArray"; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); GetJsonArray(JArray); JArray.AddFirst(Variables); JSON := JArray.ToString; TempBlob.WriteAsText(JSON,TEXTENCODING::UTF8); END; END; [External] PROCEDURE GetVariableValue@22(VAR Value@1000 : Variant;VariableName@1001 : Text) : Boolean; VAR JSONMgt@1002 : Codeunit 5459; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); IF GetJObjectFromCollectionByIndex(Variables,0) THEN EXIT(GetPropertyValueFromJObjectByName(Variables,VariableName,Value)); END; END; [External] PROCEDURE GetVariableTextValue@23(VAR TextValue@1002 : Text;VariableName@1000 : Text) : Boolean; VAR Value@1001 : Variant; BEGIN IF GetVariableValue(Value,VariableName) THEN BEGIN TextValue := FORMAT(Value); EXIT(TRUE); END; END; [External] PROCEDURE GetVariableBooleanValue@24(VAR BooleanValue@1002 : Boolean;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN EXIT(EVALUATE(BooleanValue,TextValue,9)); END; [External] PROCEDURE GetVariableDateValue@25(VAR DateValue@1002 : Date;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN EXIT(EVALUATE(DateValue,TextValue,9)); END; [External] PROCEDURE GetVariableDateTimeValue@26(VAR DateTimeValue@1002 : DateTime;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN IF EVALUATE(DateTimeValue,TextValue,9) THEN EXIT(TRUE); EXIT(EVALUATE(DateTimeValue,TextValue)); END; [External] PROCEDURE GetVariableDecimalValue@27(VAR DecimalValue@1002 : Decimal;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN EXIT(EVALUATE(DecimalValue,TextValue,9)); END; [External] PROCEDURE GetVariableIntegerValue@28(VAR IntegerValue@1002 : Integer;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN EXIT(EVALUATE(IntegerValue,TextValue,9)); END; [External] PROCEDURE GetVariableGUIDValue@29(VAR GuidValue@1002 : GUID;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN IF GetVariableTextValue(TextValue,VariableName) THEN EXIT(EVALUATE(GuidValue,TextValue,9)); END; [External] PROCEDURE GetVariableBLOBValue@63(VAR TempBlob@1002 : Record 99008535;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN TempBlob.INIT; IF GetVariableTextValue(TextValue,VariableName) THEN TempBlob.WriteAsText(TextValue,TEXTENCODING::UTF8); EXIT(TempBlob.Blob.HASVALUE); END; [External] PROCEDURE GetVariableBLOBValueBase64String@10000000(VAR TempBlob@1002 : Record 99008535;VariableName@1000 : Text) : Boolean; VAR TextValue@1001 : Text; BEGIN TempBlob.INIT; IF GetVariableTextValue(TextValue,VariableName) THEN TempBlob.FromBase64String(TextValue); EXIT(TempBlob.Blob.HASVALUE); END; [External] PROCEDURE GetEncryptedVariableTextValue@65(VAR TextValue@1002 : Text;VariableName@1000 : Text) : Boolean; VAR EncryptionManagement@1003 : Codeunit 10000221; Value@1001 : Variant; BEGIN IF GetVariableValue(Value,VariableName) THEN BEGIN TextValue := EncryptionManagement.DecryptText(FORMAT(Value)); EXIT(TRUE); END; END; [External] PROCEDURE GetJSON@61() : Text; VAR JSONMgt@50001 : Codeunit 5459; JArray@50000 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JArray"; BEGIN WITH JSONMgt DO BEGIN InitializeCollection(JSON); GetJsonArray(JArray); JArray.AddFirst(Variables); EXIT(JArray.ToString); END; END; [External] PROCEDURE FindInterfaceCodeunit@12(CodeunitName@1000 : Text) : Boolean; VAR Object@1001 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Codeunit); Object.SETRANGE(Name,CodeunitName); EXIT(Object.FINDFIRST); END; [External] PROCEDURE GetInterfaceCodeunitID@13(CodeunitName@1000 : Text) : Integer; VAR Object@1001 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Codeunit); Object.SETRANGE(Name,CodeunitName); Object.FINDFIRST; EXIT(Object.ID); END; [External] PROCEDURE FindTable@73(TableName@1000 : Text) : Boolean; VAR Object@1001 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Table); Object.SETRANGE(Name,TableName); EXIT(Object.FINDFIRST); END; [External] PROCEDURE GetTableID@74(TableName@1000 : Text) : Integer; VAR Object@1001 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Table); Object.SETRANGE(Name,TableName); Object.FINDFIRST; EXIT(Object.ID); END; [External] PROCEDURE ExecuteInterfaceCodeunitIfExists@14(CodeunitName@1000 : Text;VAR TempBlob@1001 : Record 99008535;ErrorIfNotFound@1002 : Text); VAR Object@1004 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Codeunit); Object.SETRANGE(Name,CodeunitName); IF NOT Object.FINDFIRST THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; IF NOT HasCodeunitExecuteLicense(Object.ID,ErrorIfNotFound) THEN EXIT; CODEUNIT.RUN(Object.ID,TempBlob) END; [External] PROCEDURE TryExecuteInterfaceCodeunitIfExists@15(CodeunitName@1000 : Text;VAR TempBlob@1001 : Record 99008535;ErrorIfNotFound@1002 : Text) : Boolean; VAR Object@1004 : Record 2000000001; BEGIN Object.SETRANGE(Type,Object.Type::Codeunit); Object.SETRANGE(Name,CodeunitName); IF NOT Object.FINDFIRST THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; IF NOT HasCodeunitExecuteLicense(Object.ID,ErrorIfNotFound) THEN EXIT; EXIT(CODEUNIT.RUN(Object.ID,TempBlob)) END; [External] PROCEDURE TryExecuteCodeunitIfExists@17(CodeunitName@1000 : Text;ErrorIfNotFound@1002 : Text) Success : Boolean; VAR Object@1004 : Record 2000000001; TempBlob@10000200 : Record 99008535; BEGIN Object.SETRANGE(Type,Object.Type::Codeunit); Object.SETRANGE(Name,CodeunitName); IF NOT Object.FINDFIRST THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; IF NOT HasCodeunitExecuteLicense(Object.ID,ErrorIfNotFound) THEN EXIT; CODEUNIT.RUN(Object.ID,TempBlob); InitializeFromTempBlob(TempBlob); GetVariableBooleanValue(Success,'Success'); END; [External] PROCEDURE ExecuteAzureFunction@60() Success : Boolean; VAR TempBlob@10000205 : Record 99008535; HttpWebRequestMgt@10000200 : Codeunit 1297; FileManagement@10000204 : Codeunit 419; ResponseInStream@10000203 : InStream; HttpStatusCode@10000202 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.HttpStatusCode"; ResponseHeaders@10000201 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Collections.Specialized.NameValueCollection"; AzureServiceURL@10000206 : Text; OmmitWebRequest@10000207 : Boolean; BEGIN GetAsTempBlob(TempBlob); IF (NOT GetVariableTextValue(AzureServiceURL,'AzureServiceURL')) OR (AzureServiceURL = '') THEN AzureServiceURL := 'https://proxy.navleiga.is/api/run'; OnBeforeExecuteAzureFunction(TempBlob,AzureServiceURL,OmmitWebRequest); IF NOT OmmitWebRequest THEN BEGIN HttpWebRequestMgt.Initialize(AzureServiceURL); HttpWebRequestMgt.DisableUI; HttpWebRequestMgt.SetMethod('POST'); HttpWebRequestMgt.SetContentType('application/json'); HttpWebRequestMgt.SetReturnType('application/json'); HttpWebRequestMgt.AddBodyBlob(TempBlob); TempBlob.INIT; TempBlob.Blob.CREATEINSTREAM(ResponseInStream,TEXTENCODING::UTF8); IF NOT HttpWebRequestMgt.GetResponse(ResponseInStream,HttpStatusCode,ResponseHeaders) THEN IF NOT HttpWebRequestMgt.ProcessFaultResponse('http://www.advania.is') THEN BEGIN Initialize; AddVariable('Exception',GETLASTERRORTEXT); EXIT(FALSE); END; END; InitializeFromTempBlob(TempBlob); GetVariableBooleanValue(Success,'Success'); END; [External] PROCEDURE HasCodeunitExecuteLicense@30(CodeunitId@1002 : Integer;ErrorIfNotFound@1001 : Text) : Boolean; VAR LicensePermission@1000 : Record 2000000043; BEGIN LicensePermission.SETRANGE("Object Type",LicensePermission."Object Type"::Codeunit); LicensePermission.SETRANGE("Object Number",CodeunitId); LicensePermission.FINDFIRST; IF LicensePermission."Execute Permission" = LicensePermission."Execute Permission"::" " THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; EXIT(TRUE); END; [External] PROCEDURE HasTableExecuteLicense@75(TableId@1002 : Integer;ErrorIfNotFound@1001 : Text) : Boolean; VAR LicensePermission@1000 : Record 2000000043; BEGIN LicensePermission.SETRANGE("Object Type",LicensePermission."Object Type"::Table); LicensePermission.SETRANGE("Object Number",TableId); LicensePermission.FINDFIRST; IF LicensePermission."Execute Permission" = LicensePermission."Execute Permission"::" " THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; EXIT(TRUE); END; [External] PROCEDURE HasTableDataReadLicense@77(TableId@1002 : Integer;ErrorIfNotFound@1001 : Text) : Boolean; VAR LicensePermission@1000 : Record 2000000043; BEGIN LicensePermission.SETRANGE("Object Type",LicensePermission."Object Type"::TableData); LicensePermission.SETRANGE("Object Number",TableId); LicensePermission.FINDFIRST; IF LicensePermission."Read Permission" = LicensePermission."Read Permission"::" " THEN IF ErrorIfNotFound <> '' THEN ERROR(ErrorIfNotFound) ELSE EXIT; EXIT(TRUE); END; LOCAL PROCEDURE PopulateAnyTableFromJson@57(JsonObject@1000 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject";FieldNameFilter@1002 : Text;VAR RecRef@1001 : RecordRef); VAR Field@10017208 : Record 2000000041; JSONMgt@10017206 : Codeunit 5459; FldRef@10017205 : FieldRef; FldIndex@10017204 : Integer; FieldName@1003 : Text; BEGIN WITH JSONMgt DO BEGIN Field.SETRANGE(TableNo,RecRef.NUMBER); Field.SETFILTER(FieldName,FieldNameFilter); FOR FldIndex := 1 TO RecRef.FIELDCOUNT DO BEGIN FldRef := RecRef.FIELDINDEX(FldIndex); Field.SETRANGE("No.",FldRef.NUMBER); IF Field.FINDFIRST THEN IF Field.Class = Field.Class::Normal THEN BEGIN FieldName := FldRef.NAME; OnBeforeGetPropertyValueFromJObjectByPathSetToFieldRef(RecRef,FieldName); GetPropertyValueFromJObjectByPathSetToFieldRef(JsonObject,RemoveNonAplhaNumericCharacters(FieldName),FldRef); OnAfterGetPropertyValueFromJObjectByPathSetToFieldRef(RecRef,FldRef); END; END; END; END; LOCAL PROCEDURE PopulateJsonFromAnyTable@58(RecRef@1000 : RecordRef;FieldNameFilter@1001 : Text;VAR JsonObject@10017201 : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject"); VAR TempBlob@10018400 : Record 99008535; Field@10017209 : Record 2000000041; JSONMgt@10017207 : Codeunit 5459; FldRef@10017204 : FieldRef; FldIndex@10017203 : Integer; FieldName@1002 : Text; BEGIN WITH JSONMgt DO BEGIN Field.SETRANGE(TableNo,RecRef.NUMBER); Field.SETFILTER(FieldName,FieldNameFilter); InitializeEmptyObject; GetJSONObject(JsonObject); FOR FldIndex := 1 TO RecRef.FIELDCOUNT DO BEGIN FldRef := RecRef.FIELDINDEX(FldIndex); Field.SETRANGE("No.",FldRef.NUMBER); IF Field.FINDFIRST THEN IF Field.Class = Field.Class::Normal THEN BEGIN FieldName := FldRef.NAME; OnBeforeAddJPropertyToJObject(RecRef,FieldName); IF FORMAT(FldRef.TYPE) = 'BLOB' THEN BEGIN FldRef.CALCFIELD; TempBlob.Blob := FldRef.VALUE; AddJPropertyToJObject(JsonObject,RemoveNonAplhaNumericCharacters(FieldName),TempBlob.ToBase64String); END ELSE AddJPropertyToJObject(JsonObject,RemoveNonAplhaNumericCharacters(FieldName),FldRef.VALUE); END; END; END; END; LOCAL PROCEDURE RemoveNonAplhaNumericCharacters@59(OldValue@1003 : Text) : Text; VAR DotNetChar@1002 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Char"; NewValue@1001 : Text; I@1000 : Integer; BEGIN NewValue := ''; FOR I := 1 TO STRLEN(OldValue) DO BEGIN IF DotNetChar.IsLetterOrDigit(OldValue[I]) THEN NewValue += FORMAT(OldValue[I]); END; EXIT(NewValue); END; [Integration] LOCAL PROCEDURE OnBeforeGetPropertyValueFromJObjectByPathSetToFieldRef@8(VAR RecRef@1000 : RecordRef;VAR FieldName@1001 : Text); BEGIN END; [Integration] LOCAL PROCEDURE OnAfterGetPropertyValueFromJObjectByPathSetToFieldRef@9(VAR RecRef@1000 : RecordRef;FldRef@1001 : FieldRef); BEGIN END; [Integration] LOCAL PROCEDURE OnBeforeAddJPropertyToJObject@16(RecRef@1000 : RecordRef;VAR FieldName@1001 : Text); BEGIN END; [Integration] LOCAL PROCEDURE OnBeforeGetJObjectFromCollectionByPropertyValue@20(RecRef@1001 : RecordRef;VAR KeyFieldName@1002 : Text); BEGIN END; [Integration] LOCAL PROCEDURE OnBeforeExecuteAzureFunction@42(VAR TempBlob@10000202 : Record 99008535;VAR AzureServiceURL@10000201 : Text;VAR OmmitWebRequest@10000200 : Boolean); BEGIN END; EVENT Variables@1001::PropertyChanged@117(sender@10000201 : Variant;e@10000200 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.ComponentModel.PropertyChangedEventArgs"); BEGIN END; EVENT Variables@1001::PropertyChanging@118(sender@10000201 : Variant;e@10000200 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.ComponentModel.PropertyChangingEventArgs"); BEGIN END; EVENT Variables@1001::ListChanged@119(sender@10000201 : Variant;e@10000200 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.ComponentModel.ListChangedEventArgs"); BEGIN END; EVENT Variables@1001::AddingNew@120(sender@10000201 : Variant;e@10000200 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.ComponentModel.AddingNewEventArgs"); BEGIN END; EVENT Variables@1001::CollectionChanged@121(sender@10000201 : Variant;e@10000200 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Collections.Specialized.NotifyCollectionChangedEventArgs"); BEGIN END; BEGIN END. } }