Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How can I set a variable as parameter of OnCreatePick function?

(0) ShareShare
ReportReport
Posted on by 25

Hi team, 

We are trying to call the native function OnCreatePickDocOnBeforeCreatePickDoc, which asks for the following parameters: (Rec, WhseShptLine, WhseShptHeader2, HideValidationDialog, IsHandled), we handle to pass most of these parameters, but not sure how to pass the Rec, because this Rec is the Warehouse Shipment Line where the function is supose to be run native, but we are running our development from Purchase Order, so the Rec is Purchase Order instead of Warehouse Shipment Line. We are trying to pass the Warehouse Shipment Line instead of Rec, but getting the following error:

pastedimage1681418093879v1.png

Any ideas that could help us?

Thank you in advanced.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 77,981 Super User 2025 Season 1 on at
    RE: How can I set a variable as parameter of OnCreatePick function?

    Hi, You use Alt + Shift + E to search for OnCreatePickDocOnBeforeCreatePickDoc in VS Code, and when you add it, it will automatically display the variable name.

    For example,

    pastedimage1681429686942v1.png

    pastedimage1681429702601v2.png

    Also, you find the location of this event and you can see it.

    pastedimage1681429727370v3.png

    Hope this helps.

    Thanks.

    ZHU

  • malte610 Profile Picture
    malte610 5 on at
    RE: How can I set a variable as parameter of OnCreatePick function?

    Hi Antea,

    I really hate to be this guy, but you should really look into the documentation. A record variable can represent just the structure of a table or contain data. The error you are receiving says basically you are trying to pass a simple data type into a complex. In other languages this would be like trying to pass in string where a class is expected. Furthermore, I am not completely, sure but I can't imagine situation where you want to create a Warehouse Shipment Line/Pick from a Purchase Order right now. Although I could be wrong. Usually Purchase Orders are associated with Warehouse Receipt Line and Put-Away.

    By the way: there are many free courses

    I hope this points you into the right direction.

    Malte

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans