Hi All,
I am facing problem with setting and accessing a global boolean var.
I have added a global boolean var. CalledFromSynchronisation to SalesLine table. This table contains a fn. to set the value of this var.as shown below:
SetCalledFromSynchronisation(Flag : Boolean)
{
CalledFromSynchronisation := Flag;
}
I have a codeunit which modifies the SalesHeader record as below:
UpdateSalesHeader(VAR SalesHeader : Record Sales Header)
{
....................
SalesHeader.VALIDATE("Sell-to Customer No.");
..........
}
The above validation calls the below fn. of SalesHeader table
RecreateSalesLines()
{
...............
//Purpose : Set synchronisation flag to restrict deletion of Items
SalesLine.SetCalledFromSynchronisation(TRUE);
SalesLine.DELETEALL(TRUE);
....................
}
Note: Modified code is in red bits
When the OnDelete() of SalesLine table is called from the above fn. and i debug the OnDelete(), what i found is that the global boolean var. CalledFromSynchronisation is not set to TRUE in spite of settting it explicitly from RecreateSalesLines(). The OnDelete() of SalesLine table is as follows:
OnDelete()
{
.......
IF NOT CalledFromSynchronisation THEN
//do someting
.......
}
While debugging when i place curson at CalledFromSynchronisation var. above it shows me "No"
I am unable to trap this.
Pls help.
Regards,
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
It means that there is no flag set in the InternalVar instance of the table. As ara3n wrote, try to use the loop instead DELETEALL.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.