Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Using Function Start Session and assign Automatically a new session ID

Posted on by 460

Dea All,

Iam trying to fire STARTSESSION function in Navision 2016. I have a CU which will insert for me a new record in a table.

I am using the function like this:

***********************************

OK:= STARTSESSION(SessionID, CODEUNIT::"Mza_Insert_In_Table", 'TestCompany','');

IF OK THEN
  STOPSESSION(SessionID, 'Record was inserted');
ELSE
 ERROR('Session was stopped')

************************************

Each time I run this code I get this error: "Avariable was expected" and Navision aims to field "Session ID"

 

------ > "Session ID" is a variable of type Int. I thought navision will assign the the session ID Automatically! or I have to assign the session ID manually? If yes how can I do it?

*This post is locked for comments

  • Verified answer
    RE: Using Function Start Session and assign Automatically a new session ID

    Hi,

    Also please check this blog post: krikinav.wordpress.com/.../parallel-processing-in-dynamics-nav which explains about Parallel Processing in NAV, which heavuly uses STARTSESSION.

    Hope it helps

  • M.Zayed Profile Picture
    M.Zayed 460 on at
    RE: Using Function Start Session and assign Automatically a new session ID

    Thanks A lot :), its working now :)

  • Verified answer
    RE: Using Function Start Session and assign Automatically a new session ID

    Hi Zayed,

    You can write this code like this.

    STARTSESSION(SessionEvent."Session ID",CODEUNIT::"Parallel Processing 2",COMPANYNAME,ItemLedgerEntryTMP01);

    SessionEvent is a Temporary Table which's ID is 2000000111, Session Event.

    Hope it helps.

  • M.Zayed Profile Picture
    M.Zayed 460 on at
    RE: Using Function Start Session and assign Automatically a new session ID

    Thanks for the replay. But can you explain more in details please. I already  Created a C/Al variable of type INT  for the SessionID in the code which you see above. but still its not working?

  • RE: Using Function Start Session and assign Automatically a new session ID

    Hi,

    You have to create a C/AL variable for SessionID. After the session is started, the ID is assigned to the SessionID variable after the session is started successfully.

    Hope it helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans