Skip to main content

Notifications

Announcements

No record found.

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 74,115 Super User 2024 Season 2 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

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans