web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Converting a recid to formdatasource format

(0) ShareShare
ReportReport
Posted on by

Hi Team,

I have a customised class in which I want to call a standard class method example 

the class is WhsUnshipLoadLine and the method is unship().

now this method takes formdatasoucre as parameter but since I am using it in custom class and this method is not being called from a form, I want to somehow pass recid as argument in this parameter when calling this method in my class. Is it possible to convert a recid value to formdatasource format and then passing it in the method parameter? Please help.

I have the same question (0)
  • Martin Dráb Profile Picture
    238,734 Most Valuable Professional on at

    My F&O doesn't contain any class called WhsUnshipLoadLine, just a form and an a menu item. Is it the right name? If so, isn't it a custom class?

    But in short, it doesn't sound like a good method for your purpose.

  • Karuna Dogra Profile Picture
    on at

    Thanks for responding Martin,

    My bad the class name is whsUnshipLoadLineForm and the method inside thhis class is unship.

  • Martin Dráb Profile Picture
    238,734 Most Valuable Professional on at

    What RecId do you have? If it's a RecId of WHSTmpLoadLineInventory table, it's useless without a reference to a temporary data set. WHSTmpLoadLineInventory is a temporary table is has no data in database at all.

    Regarding the method, you can see thayt it isn't good for your purpose, because it requires a form data source, while you don't have any. And you can't create a form data source without a form.

    I would look into unship() method and borrow the logic I need. You'll see that most work is done by WHSUnShip class.

    Note that other parts of the method are not relevent in your case. For example, the logic getting records selected in a grid makes no sense when you don't have a form. Also, there is no point in running a while select against multiple records if you have just a single one (I'm not sure by that, it's just an assumption).

  • Karuna Dogra Profile Picture
    on at

    Thank you Martin,

    Actually I am creating a OData action method in which I want to call this method and automatically perform the unship method functionality. Shoul I write a replicate of that method in my custom class to perform that functionality without automatically without form interaction.

    Please help.

  • Karuna Dogra Profile Picture
    on at

    Any suggestions please help

  • Karuna Dogra Profile Picture
    on at

    Any suggestions please help

  • Martin Dráb Profile Picture
    238,734 Most Valuable Professional on at

    Please see my suggestion above. If you don't like it, please explain what problem you have with it.

    Repearing "Any suggestions please help" is useless, because it provides no information on the topic.

  • Karuna Dogra Profile Picture
    on at

    0172.image.jpg

    Example-

  • Karuna Dogra Profile Picture
    on at

    Actually my  scenario is… I have created a custom table XYZWhsUnshipLoadLineTable and a custom data entity ‘XYZWhsUnshipLoadLineEntity’ for this table. A  third party is filling the data in this custom table through OData and now we need to create a OData action on this entity so that they can call this action method and through that method the we could perform the unshipping of quantity automatically.

    It’s like once they have filled the data into the table we have to call the whsunshiploadlineform.unship() method and reduce the quantity for the laod lines which they have sent into the table.

    Now my question is -

    1. Since the method takes formdatasource as the argument then I will I have to write my own logic similar to whsunship class to reduce the quantity right?

    2. Can I create multiple methods inside my entity class to perform this activity.

    Please see screenshot below

  • Martin Dráb Profile Picture
    238,734 Most Valuable Professional on at

    1. I already addressed this above. Yes, you need a custom method, but you shouldn't implement something similat to WhsUnship class. You should use this class in your method.

    2. Yes, both entities and classes can have more than one method.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 577 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans