Hi,
I am an apprentice in the first year and my englisch isn't very good.
I have a database with two fields "Line Status" with Field-Value Option and a field names "Last Modified at".
My problem is, if the "Last Modified at"-Date is older than a few days (for example 16 days) and the Value of "Line Status" is "finished", the Value of "Line Status" shoult set to "closed" automatically and if the "Last Modified at"-Date is older than only for example 14 days (it must be less days than the first days), navision should automatically send an E-Mail to the user.
My second problem is, if i calculate the amount of the days, i have to discount Sunday and Saturday so i calculate working-days.
I have already written a code, but i don't know what i should do. In this code are no error messages occured.
Here is my Code:
ServiceItemLine.SETRANGE("Line Status");
ServiceItemLine.SETRANGE("Last Modified at");
ServiceItemLine.FIND('-');
IF LineStatus = ServiceItemLine."Line Status"::finished THEN BEGIN
REPEAT
IF ServiceItemLine."Last Modified at" < (TODAY - 16) THEN BEGIN
MESSAGE('Das Datum wurde vor 16 Tagen zuletzt geändert');
END;
UNTIL ServiceItemLine.NEXT = 0;
END;
For now the code gives me a Message because i can see, if it works.
I hope you can help me.
Comments
If I am understanding your problem correctly you want the Line Status to automatically be updated if specific criteria are met. You have 2 basic options here that I can think of. The first would be to create a 'Periodic Activity', probably using a Processing only Report, that a user would run. This would examine each line for your criteria and then update the status accordingly. If you want the routine to run with zero user interaction, i.e. it just happens, then you will need to use an Application server. You would set it to run a codeunit that would periodically check the lines and perform updates.
The second part of the problem, i.e. getting it to ignore Saturday and Sunday will require a bit more work. I think you will have to use the Calendar functionality in NAV to set up your working days and then have your code refer to this to work out when the required number of working days have passed.
If you would like help in structuring either option let me know and I'll dig out some examples for you.
Ian
Ian
thanks for your help.
But the problem with Saturday and Sunday is in solution.
It would be interesting for me.
i am ready now.
It is running.