Hi,
I open a STRMENU window through a function in a codeunit which set the users choice and save it in a Variable.(integer form 1 to 4)
This codeunit calls the Contact rec.
It works fine but it runs in a loop stage(finds a contact and ask through the menu to set a choice over and over again).
What i wanted to do is to set this choice just once and keep that chosen integer(for example 1)for all the contacts, and then through IF THEN statements run different operations:
IF Variable = 1 THEN
DO THIS;
IF variable = 2 THEN
DO THIS
Is there a possibility to achieve this???
Best regards
Alva1
0
Answers
For the not looping, you could write your own function, instead of calling the codeunit
|To-Increase|
Thank you for your quick response!
My first initial thought was to run the STRMENU through a form, so the variable would be set only once.
What i don't really know how to do is to give the value of the variable to the codeunit(so the codeunit take the variable and runs the function using the given value!)
any tips or ideas??
Alva1
Can you put a part of the code you're trying to do here?
It's hard to understand what you really want/need... :-k
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com
Select the function you want to use and click on 'locals'.
There you see in the first tab (parameters) which parameters the function requires.
If there aren't any parameters, you can't pass along parameters unless you edit that function. (not recommended)
If you just run the codeunit, the 'run' function does not have any parameters thus you can't pass along parameters.
to pass along parameters use something like this
var_cu (global or local variable of the type codeunit and subtype the codeunit you want to use)
var_int (your integer which represents the option?)
var_cu.function(var_int); //<- this line calls the codeunit's function with the integer as parameter
|To-Increase|
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC
but i think i didn't explain it very well so ill do it better this time:
is about the Outlook Synchronisation.
When the user opens the Salesperson Purchaser card, there is this outlook Synch tab, what i wanted to do is when people press this button to synch(or sometime between the whole process) a MESSAGE pops out and ask the user how does he want to save the contacts in Outlook, automatically after that the STRMENU pops out showing 4 options
1)option 1
2)Option 2
3)Option 3
4)Option 4
If the user press cancel, the form will automatically close.
I managed to do this, but now comes the tricky part:
The Codeunit 5069 Outlook Contact Handler is the one incharge of creating contacts in Outlook, and there is this function ASSIGN which is incharge of assign the different navision fields to Outlook.
For example:
OlContactFileAs := Cont.Name
here is where i write some IF THEN statements to set how the contacts should be saved in Outlook
For example:
IF OptionChoosenFromUser = 1 THEN
OlContactFileAs := Cont."Company Name"+' '+Cont.Name;
IF OptionChoosenFromUser = 2 THEN
OlContactFileAs := Cont.Name
and so on.
what i wanted is to save somehow the Option choosen from the user and use it for every loop in this function ASSIGN.
but i don't really know how to do this and which is the best way!
Alva1
And one tip: try to use CASE statement instead
if something = x then
if something = y then
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Alva1