procedure GetCustomerAsJSONObject(Customer: Record Customer): JsonObject
var
SerializationUtil: Codeunit SULSerializationUtilNVX;
JObject: JsonObject;
BodyContent: Text;
begin
BodyContent := SerializationUtil.Serialize(Customer, Enum::SULSerializerTypeNVX::JSON, Enum::SULSerializableTypeNVX::Record);
exit(JObject.WriteTo(BodyContent));
end;
procedure GetCustomerSelectedFieldsAsJSONObject(Customer: Record Customer; SlectedFields: List of [Integer]): JsonObject
var
SerializationUtil: Codeunit SULSerializationUtilNVX;
JObject: JsonObject;
BodyContent: Text;
begin
BodyContent := SerializationUtil.Serialize(Customer, Enum::SULSerializerTypeNVX::JSON, SelectedFields, Enum::SULSerializableTypeNVX::Record);
exit(JObject.WriteTo(BodyContent));
end;
local procedure UpdateCustomerFromApi(CustomerNo: Code[20]; Response: Text)
var
Customer: Record Customer;
SerializationUtil: Codeunit SULSerializationUtilNVX;
JsonFieldMapping: Dictionary of [Integer, Text];
DeserializationFailed: List of [Text];
Json: JsonObject;
begin
//JsonFieldMapping consists of the Field No. of the BC Record as key and the respective Json Token from the response as value
//DeserializationFailed contains the Json Tokens which must be deserialized manually
ThrowError.IfCustomerDoesNotExist(Customer, CustomerNo);
JsonFieldMapping.Add(2, 'name');
JsonFieldMapping.Add(4, 'name2');
Json.ReadFrom(Response);
SerializationUtil.Deserialize(
Json,
MKSHeader,
Enum::SULDeserializerTypeNVX::JSON,
JsonFieldMapping,
DeserializationFailed);
end;
Finmatics Autonomous Accounting Schnittstelle für KI-gesteuerte Belegverarbeitung von Finmatics. Weitere Informationen AppSource |