I am trying to open the form “General Journal” (39) from a CONFIRM statement at the end of a dataport. I get the question, but no matter which option I choose the form will not open. Here is the code : IF CONFIRM (‘The Payroll file’ + FORMAT(CurrDataport.FILENAME)+’ has been imported. Do you wish to open the journal now ?’) THEN FORM.RUN(FORM::“General Journal”,“Gen. Journal Line”); NOTE: I have already setrange on the dataport for the Template name and batch name. Also, as the filename includes the backslash () character, Financials is interpreting this a new line command. Is there a way around this without omitting the filename ?
This Should fix your backslash problem : IF CONFIRM (‘The Payroll file’ + STRSUBSTNO(’%1’) +’ has been imported. Do you wish to open the journal now ?’, FALSE, CurrDataport.FILENAME) THEN FORM.RUN(FORM::“General Journal”,“Gen. Journal Line”); If the Confirm do not work at the end of the dataport what you could do is create a codeunit which does the following : YourDaport.RUNMODAL; IF CONFIRM (…) THEN BLAH; email@example.com
Use FORM.RUNMODAL instead of FORM.RUN !!! ------- With best regards from Switzerland Marcus Fabian
silly question but have you committed the records first? You need to make the form a variable! then you need to pass to the form a record or set filters for the template and batch then open it. Look at the GenJnlManagement open journal functions for the filters. David Cox MindSource (UK) Limited Navision Solutions Partner Email: firstname.lastname@example.org Web: www.mindsource.co.uk
Fabian: I have tried your suggestion, and at least I get a response. However I get a horrible error message saying that I cannot use this command with write transactions(please see download attachment). David: To answer you question - I thought that I had by using this code in the “OnPreDataItem”: SETRANGE(“Journal Template Name” ,‘General’); SETRANGE(“Journal Batch Name”,‘Payroll’); Is this what you had in mind ? download
Dean : Add this line : COMMIT; before your FORM.RUNMODAL(… As David pointed out your record is not yet commited to the Database when you’re trying to run your form email@example.com
Tarik: Thanks for that.The journal now opens. Slight problem though… the import update window is stuck on my screen !!! Any Suggestions ??
Well, it appears that the way in which I am approaching this is all wrong. After advice from my NTR, I need to write an additional object to call this dataport, and when the dataport has completed, I need to then call my CONFIRM statement. It seems strange to reply to my own postings, but as i have gained invaluable experience from this forum, i feel it is the right thing to do, if a solution presents itself. Once again, many thanks to you all.