Open ajkauffmann opened 3 years ago
Normally you can only add the need parameters to a event subscriber. Without the Dotnet parameters a event subscriber should be possible. The following snippet does not create any error in my dummy project.
[IntegrationEvent(false, false)]
local procedure OnFillPackageMetadataFromXMLOnAfterGetPackageTableValueFromXML(ConfigPackageTable: Record "Config. Package Table"; var TableNode: DotNet XmlNode)
begin
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Config. XML Exchange", 'OnFillPackageMetadataFromXMLOnAfterGetPackageTableValueFromXML', '', false, false)]
local procedure OnFillPackageMetadataFromXMLOnAfterGetPackageTableValueFromXML(ConfigPackageTable: Record "Config. Package Table")
begin
end;
}
Wouldn't it be better if the Codeunit is refactored to the new XMl Types with new events....
Sure, I know that you can leave the parameters you don't need. But in this case, I need the Xml parameter.
Obviously, the best way to get rid of the DotNet parameters is to refactor the codeunit. I guess Microsoft is smart enough to recognize that. 😊 But after all, I don't really care what variable types are used internally, as long as I can use the events. 😊
Hi,
Do you have any suggestions which parameters should be used instead of DotNet to fit you needs (same object as text, etc)? It would be nice to have some scenarios/examples of using those events to simplify the refactoring.
It is used to create extra XML elements and add them to the TableNode parameter. In this case a feature that is similar to "Dimensions as Columns", but for item specifications.
For example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Config. XML Exchange", 'OnAfterAddTableAttributes', '', false, false)]
local procedure OnAfterAddTableAttributes(ConfigPackageTable: Record "Config. Package Table"; var PackageXML: DotNet XmlDocument; var TableNode: DotNet XmlNode)
var
FieldNode: DotNet XmlNode;
begin
if ConfigPackageTable."Item Spec. as Columns" then begin
FieldNode := PackageXML.CreateElement(ConfigXMLExchange.GetElementName(ConfigPackageTable.FieldName("Item Spec. as Columns")));
FieldNode.InnerText := '1';
TableNode.AppendChild(FieldNode);
end;
end;
Can you please remove the DotNet variables from the events in codeunit 8614 "Config. XML Exchange"
Some events in this codeunit pass parameters as DotNet objects. So they can't be used in a cloud extension. Internal work item: AB#416596