Header and Fields in codeunit 5054 out of sync [AL #1620]
Issue moved from AL repo, where the full thread can be found. https://github.com/Microsoft/AL/issues/1620
As mentioned in the code example in Microsoft/AL#1057, the header and fields in codeunit 5054 are out of sync now. in function
[External] CreateHeader(VAR WordMergefile : DotNet "Micr....... AddNewEntry(Text015,''); <------ this is the FaxEmailValue and is the last header field.
but in function
[External] AddFieldsToMergeSource(VAR WordMergefile AddField(FaxMailToValue); <------ this value must come last and isn't now!
Thank you for your request. We are currently setting up the process around handling of issues in this new GitHub repository and you should hence expect a short delay in the processing of this request. But we will be on your case shortly!
We are having problems understanding the issue. We can't seem to find any issue. Could you elaborate?
If you believe you've found a product bug, please follow the below instructions: This GitHub repository is dedicated to handling issues with published apps and extensibility requests for the latest release of Business Central. If you run into an issue, open a support case. You can open a Support Request to CSS through PartnerSource portal or by contacting your Service Account Manager (SAM) in the local subsidiary, to understand what is included in your contract as of support incident and PAH (Partner Advisory Hours). Your SAM might also direct you "step by step" how to open a support request or how to get credentials, if this is the first time for you or your company. Another option would be to file this bug in Collaborate and include details on your Business Central build number and country. Quick link: https://developer.microsoft.com/en-us/dashboard/collaborate/engagements/1173/feedback/wits/Bugs/create.
Hi Jesper, I'm not moving this issue again, it was already moved from Microsoft/AL#1620 Please see this issue as I elaborated here.
The problem is, that the FaxEmailValue must come as the last mergefield in CreateHeader AND AddFieldsToMergeSource functions. Now the both functions are out of sync, and when you try to extend the both functions, the merge will fail.
So, the only change you need to do is the following:
In function AddFieldsToMergeSource, switch the following 2 lines:
AddNewEntry(COPYSTR(FaxMailToValue,1,MAXSTRLEN(Name)),'');
OnAddFieldsToMergeSource(TempNameValueBuffer,Salesperson,Country,Contact,CompanyInfo,SegLine,InteractLogEntry);
to:
OnAddFieldsToMergeSource(TempNameValueBuffer,Salesperson,Country,Contact,CompanyInfo,SegLine,InteractLogEntry);
AddNewEntry(COPYSTR(FaxMailToValue,1,MAXSTRLEN(Name)),'');
Thanks for clarifying! It wasn't clear to us what exactly you proposed - it is now :-)
But I'm afraid that is only part of the solution. While investigating, we found more issues than that. I've created a new bug for the correct team, which will look into it. We're on it. Finally.
I would like to know what you've found, could you share it? Is it also on GitHub?
And yes, there are more "bugs". If you extend the functions with too many fields (total more than 64, including standard NAV fields) it will fail. This is because of a bug in merging HTML tables in office. Solution for this might be the use of CSV tables.
See the original issue https://github.com/Microsoft/AL/issues/1057 for this solution.
It's just some findings we made while investigating, such as: function CreateHeader has a Boolean param MergeFieldsOnly. When this is TRUE we only write the FIRST 48 fields but now with the events, we need to write all the fields. There are some other things as well, which we'll fix while at it. We'll get back to you, once the bug is resolved.
This issue has been resolved.