Hello,
I am having an issue with the log and maybe someone can help me out. I need to pass the BatchScriptCode field a particular codeunit. But I am not sure how I can do this. I cant use the typical way of doing it, where we create a codeunit variable in the globals, in the codeunit, we can create a function called SetDefault and pass the batchscriptcode. The reason I cant do this because we don't know what the pre-mapping codeunit or mapping codeunit is going to be. This information is going to be determined by looking at DataExchMapping field.
This is how the system is currently calling these codeunit:
CODEUNIT.RUN(DataExchMapping."Pre-Mapping Codeunit" "Rec").
Any help will be appreciated.
0
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I am not that concerned about that really. Because this is going to be done before anyone has access to the system. This is going to be done by admin. This is going to be done around the same time as packages are going to be applied to a newly created company.
in my opinion there are two possibilities.
1) Store everything in the Rec. You can send a temporary record too.
2) Store the values you need for the process in another Codeunit with SingleInstance. I like working with SingleInstance Codeunits as they work as a small cache and give you a lot of possibilies. Just make sure to clear the Codeunit before use.
thinknavblog.wordpress.com
You can also pass the parameters in filters. Set filters on Rec variable, and in the codeunit you can use GETFILTER on each field to read what has been passed in the call. This is a good trick if you cannot modify the table to add a few fields required to pass parameters.
If you Rec variable is a custom table which you can modify then the easiest way is to add a few fields and pass parameters in them, as others already suggested. You don't have to use MODIFY to store values in the database, simple assignment right before CODEUNIT.RUN is OK.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
thinknavblog.wordpress.com