Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
My company has been using Microsoft dynamics NAV 2016 for the last two years. A couple of days ago one of the end users want to post entry in the JOB Journal but an error message which reads:
Microsoft Dynamics NAV---------------------------
The object has been run. Use the function CLEAR(Report).---------------------------OK---------------------------
keeps poping up and the posting process fails, what could be the cause of this error message. I really need your help ASAP.
for more info, here is the screen shot of the message
Add the CLEAR(ReportName) code wherever the Job is called. Or close the page and repeat the posting process.
Thank You Olister for your swift reply,
I've tried the closing the page and repeating the posting process it gives me the same error.
However the first solution you suggested "Add the CLEAR(ReportName) code wherever the Job is called" , how do i add the CLEAR(ReportName) in the job journal, can you give me a detailed explanation on that?
It seems so strange that the Job Journal posting is calling a report variable. Are you able to activate debugger? If so, you can see immediately where the problem is. I suspect you have here a custom implementation, maybe that opens a report after posting?
When i debug it here is what i found the error message pops up when it reaches the yellow color highlighted line of code , any idea what that is and any suggestion on how to fix it, because i'm not that familiar with C/AL codes
RUNMODAL inside a loop? This seems a wrong code.
You can place CLEAR(UpdateJobItemCost) just after the REPEAT line but this code seems wrong to me.
A RUNMODAL waits for user input and inside a loop it’s very bad because it locks the transaction.
Do you think it will cause me some other issues if i comment out the code line in the code unit? what do you think i should do?
To solve your issue, the code must be the following:
IF JobsSetup.FIND THEN IF JobsSetup."Automatic Update Job Item Cost" THEN BEGIN IF TempJobToAdjustBuf.FINDSET THEN REPEAT Job.SETRANGE("No.",TempJobToAdjustBuf."No."); CLEAR(UpdateJobItemCost); //<-- ADD THIS LINE!! UpdateJobItemCost.SETTABLEVIEW(Job); UpdateJobItemCost.USEREQUESTPAGE := FALSE; UpdateJobItemCost.SetProperties(TRUE); UpdateJobItemCost.RUNMODAL; UNTIL TempJobToAdjustBuf.NEXT = 0; END;
On the Post Action check what Customisation is done. Do not comment any code but if Report object is called then use CLEAR(ReportObject).
Use session debugging, it will direct you to th error
First i would like to thank every one who participated to give solution to the issue i posted. i really appreciate it.
especially Thank You Stefano, I added the code you suggested the entry posted with out any problem. the solution works like charm. I have one question though , does the change in the code could affect any other item cost adjustment entries or cause and issue on other item related transaction, what do you think?,
And also for my understanding on the issues can you give me a brief explanation why the issue was happening and what the code you added does? thank you again for your support.
No, tested and it works. This issues was fixed in the following releases.
The line of code simply re-initialize the variable used for posting for passing the new filters on every iteration.