Want to Validate the Code on Sales Return Form

Stivan_dsouza21
Member Posts: 218
Want to Validate the Code on Sales Return Form on Function button at Copy Document menu
IF HideValidationDialog OR NOT GUIALLOWED THEN
Confirmed := TRUE
ELSE
Confirmed := CONFIRM('Is it Cancel Invoice ?',FALSE);
IF Confirmed = TRUE THEN BEGIN
"Cancel Invoice" := TRUE;
"Posting No. Series" := 'CINV SALE';
END;
IF Confirmed = FALSE THEN BEGIN
"Cancel Invoice" := FALSE;
END;
recently this code is working on Posting No Series field....
can someone help me out....?????
IF HideValidationDialog OR NOT GUIALLOWED THEN
Confirmed := TRUE
ELSE
Confirmed := CONFIRM('Is it Cancel Invoice ?',FALSE);
IF Confirmed = TRUE THEN BEGIN
"Cancel Invoice" := TRUE;
"Posting No. Series" := 'CINV SALE';
END;
IF Confirmed = FALSE THEN BEGIN
"Cancel Invoice" := FALSE;
END;
recently this code is working on Posting No Series field....
can someone help me out....?????
Thanks & Regards,
Stivan D'souza
Stivan D'souza
0
Comments
-
what exactly is ypur problem?0
-
While doing the copy document, the system should check the posting date and document date if they are not same then a pop up of confirm box should appear saying that if you want to cancel the invoice (YES/NO)
if YES then Cancel Invoice field should be check marked and Posting No series should come as 'CINV SALE'.
IF NO then Cancel Invoice field should not be check marked.Thanks & Regards,
Stivan D'souza0 -
Where did you check whether posting date and document date are same or not?
I understood your requirement..
Whaat do u mean byrecently this code is working on Posting No Series field....
and how can we help you?0 -
the functionality is working on Posting No Series Field
now they want to block it and do it on Copy Document of sales return order.Thanks & Regards,
Stivan D'souza0 -
So What did you try and whats not working?0
-
Below is the code i have written on PUSH of Copy Document:
IF TODAY <> "Applies to Document date" THEN
BEGIN
IF HideValidationDialog OR NOT GUIALLOWED THEN
Confirmed := TRUE
ELSE
Confirmed := CONFIRM('Is it Cancel Invoice ?',FALSE);
IF Confirmed = TRUE THEN
BEGIN
"Cancel Invoice" := TRUE;
MESSAGE('%1',"Cancel Invoice"); in Message its showing correct value but not showing at form level
"Posting No. Series" := 'CINV SALE';
MESSAGE('%1',"Posting No. Series"); in Message its showing correct value but not showing at form level
END;
END;Thanks & Regards,
Stivan D'souza0 -
Not to be a douche, but why not
IF Confirmed THEN
and
IF NOT Confirmed THEN
The hair in my neck raises everytime I see Booleans used otherwise.0 -
But then too its not updating.....Thanks & Regards,
Stivan D'souza0 -
I suggest you to write the code in Codeunit Copy Document Mgt.0
-
Stivan_dsouza21 wrote:But then too its not updating.....
The above suggestion given by Duikmeester is not related to your problem..
Its regarding coding standards..0 -
Thanks Mohana......
for the information.....Thanks & Regards,
Stivan D'souza0 -
Duikmeester wrote:Not to be a douche, but why not
IF Confirmed THEN
and
IF NOT Confirmed THEN
The hair in my neck raises everytime I see Booleans used otherwise.
:thumbsup:
Some people just refuse to do it the Navision way.David Singleton0 -
Stivan_dsouza21 wrote:Thanks Mohana......
for the information.....0 -
Stivan_dsouza21 wrote:
IF TODAY <> "Applies to Document date" THEN BEGIN IF HideValidationDialog OR NOT GUIALLOWED THEN Confirmed := TRUE ELSE Confirmed := CONFIRM('Is it Cancel Invoice ?',FALSE); IF Confirmed = TRUE THEN BEGIN "Cancel Invoice" := TRUE; MESSAGE('%1',"Cancel Invoice"); // in Message its showing correct value but not showing at form level "Posting No. Series" := 'CINV SALE'; MESSAGE('%1',"Posting No. Series"); // in Message its showing correct value but not showing at form level END; END;
AddCurrForm.UPDATE(TRUE);
to your code to- Modify Rec i.e. make your changes permanent
- tell the form to display modified data
-
Remarks:
- Your code is in a Menu Item. How do you get at it when GUIALLOWED = FALSE?
- What does this have to do with today's date? If that first condition makes any sense at all it most likely ought to be WORKDATE instead of TODAY.
- You should not hardcode code values. You should create a field in some setup table to hold the value of your Cancel Invoice No. Series and use that field instead.
- Earlier on you used the following
IF Confirmed = TRUE THEN ... IF Confirmed = FALSE THEN ...
Do this only when you modify the condition in the first IF statement and need to consider that change in the second. Otherwise useIF Confirmed THEN ... ELSE ...
It's clearer, it's shorter, it's faster, it's safer.
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions