Hello all.,
Can we define a return Value in event function ,if we can not return a value is there any alternative Solution for this Problem.
Thanks in Advance.
Hello all.,
Can we define a return Value in event function ,if we can not return a value is there any alternative Solution for this Problem.
Thanks in Advance.
Hi
You can refer CU 81 - event OnBeforeConfirmSalesPost for understanding.
If you are using the standard publisher then return might not be possible unless the boolean is available in your Publisher.
If the publisher is created by you, then you can handle it using the first scenario.
regards,
Avinash B
Thanks for your Reply..
If I want to Return Boolean Type value then how can I Use First Scenario.
Hi
Scenario 1: Using VAR
When you use VAR on the variable, the changes that you make in the subscribers will remain.
For Ex.
This is one of the events in CU 80. Where the SalesLine variable is having VAR and SalesHeader doesn't have it. So when you subscribe to this event any changes you make to the variable SalesLine will be also available after coming out Subscriber.
Scenario 2: Using Single Instance CU
For this, you must create a Codunit and set the property SingleInstance=true.
So in this case, u can create a function in this CoduUnit like SetValue and GetValue.
You can use the SetValue function to store the value in the variable and GetValue can be called where you want to use it.
Refer to the below link for better understanding,
https://docs.microsoft.com/en-us/dynamics-nav/singleinstance-property
Help the community by making answer verified if it solves your issue.
Regards,
Avinash B
Can you give an example for better understand.
Hi
You can use VAR to the variable to return the value from the subscriber.
Otherwise, you can create a single instance codeunit for the purpose.
Please verify the answer to help community, if the suggestion solves the issue.
Regards,
Avinash B