I have a starnge requirement from one of my clients. They want to allow, Sales quote to be converted to Order even when there is no Quantity available. It means Yes button in the Item Availability warning message window should be visible, but they want Yes button to be invisible when item availabilty check performs in other places like Item Journal.
You need to do customization in Check Availability form to know from which area you have called that form…
I would use a different approach:
Modify codeunit 21 (or 22); check whether the “Entry Type” allows negative stock or not.
You may even check the “Source Code” to make sure where the Journal Line origins from.
This means that the user is allowed to fill inn a Item Journal Line, get the warning - but it is not allowed to post the line. And this complies with standard NAV…
- this is quite normal: Sell now, purchase later!
Yes, we can do the coding in posting routene to restrict the posting but, my requirement is to disable/ Invisible the Yes button on Check Availaility form when posting a Purchase Return and to make the button visible when converting Sales quote to Order.
Please let me know if there is any possibility of calling a form with a button visible or Invisible either using run or runmodal.
Can you give an idea how to cutomize it? I think if we know the idea of calling/running a form with a button visible or invisble, we can probably use that code in “Item-Check Avail.” code unit.
Form 342, design-mode:
- Click Yes-button; properties → Name: YESBUTTON
- Create global boolean-variable “boDisableYesButton”
- Create Function fnSetDefaults við boolean-parameter “p_boDisableYesButton”. Assign the global variable from the parameter.
- In trigger OnOpenForm write “CurrForm.YESBUTTON.ENABLED(NOT boDisableYesButton);”
(I know, bat habit to use NOT in a statement. But here it’s useful!)
In function ItemJnlCheckLine, between first and second line, write “CheckItemAvail.fnSetDefaults(TRUE);”
If I didn’t misunderstand your request, this code should work [:)]