How to CODE, Called Object is Called from Which Object?

Ravi_ThakkarRavi_Thakkar Member Posts: 392
Hallo All,

I know, it is possible in NAV to know that, Called Object is Called from which Object.

E.G.

I am doing one Action in FORM 12. Which calls Codeunit X.
Also doing one Action in FORM 13 Which Calls Codeunit X.

My requirement is to write one Condition in Codeunit X that,

If X is Called from FORM 12 then Do TASK1
ELSE IF X is Called from FORM 13 then Do TASK2

But, no idea How to do that?

Any suggestion?
Ravi_Thakkar
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com

Answers

  • manisharma31manisharma31 Member Posts: 285
    hi,
    you can write a code somwthing like,

    if form.runmodal(Form::12) then
    Codeunit1.run
    else if form.runmodal(Form::13) then
    Codeunit2.run;
    Regards,
    Manish
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    You could create a new function within your codeunit SetCalledByForm(FormID) and call this function each time right before you call your condition function.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • veerendraveerendra Member Posts: 66
    I agree with einsTeIn.NET
    Veerendra Ch.
    http://midynav.blogspot.com/ (Microsoft Dynamics Navision)
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    hi,
    you can write a code somwthing like,

    if form.runmodal(Form::12) then
    Codeunit1.run
    else if form.runmodal(Form::13) then
    Codeunit2.run;
    Thanks for your reply.
    Purpose solved.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
Sign In or Register to comment.