Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Get current record value from Class Method using COC

(1) ShareShare
ReportReport
Posted on by 750
Hello everyone,
 
I'm interested in retrieving the current record values when using class methods in COC. Similar to how we obtain them in DataSource methods or Table methods, could someone provide a code example?
 
Thank you.
H
  • Martin Dráb Profile Picture
    233,529 Most Valuable Professional on at
    Get current record value from Class Method using COC
    I showed you what you asked for. I can't show you what you want because I don't know what it is. Your description is too vague and confusing. Please describe it once more. Don't be afraid of using more than a single sentence, explain the business requirement and consider providing a concrete example.
  • Hisham Alsayed Profile Picture
    750 on at
    Get current record value from Class Method using COC
    You example is clear for using COC but my concern is how can I get these values inside the method class (COC) to pass it to this method specially we have map not tables and I do not use map before.

    Thanks
    H
  • Martin Dráb Profile Picture
    233,529 Most Valuable Professional on at
    Get current record value from Class Method using COC
    Oh, sorry, I thought you know how to use method parameters.
     
    Here is an example of the CoC extension:
    edit JournalMarkInUseBlock inUseBlock(boolean _set, JournalTableMap _journalTable, JournalMarkInUseBlock _value)
    {
        // Access the data from parameters
        info(_journalTable.JournalId);
        
        return next inUseBlock(_set, _journalTable, _value);    
    }
  • Hisham Alsayed Profile Picture
    750 on at
    Get current record value from Class Method using COC
    Hi Martin,
     
       Can you elaborate on how can I get it by "you have it in _journalTable parameter" can you share your code here.
     
    Thanks
    H
  • Martin Dráb Profile Picture
    233,529 Most Valuable Professional on at
    Get current record value from Class Method using COC
    Please explain what you want to do with the method. Originally, you asked how to "retrieving the current record". If you mean the invent journal table record, you have it in _journalTable parameter. Now you've said something about "by passing my own values to override its function", but I have no idea what you mean by that.
  • Hisham Alsayed Profile Picture
    750 on at
    Get current record value from Class Method using COC
    Hi Martin,
     
       I try to keep my question simple and generic while I can get any insight to take it over and build my code anyhow, my issue with InventJournalCount class specefically I try to update this Edit method
     
      edit JournalMarkInUseBlock inUseBlock(boolean set, JournalTableMap _journalTable, JournalMarkInUseBlock _value)
            {
                return journalFormController.datasourceMethodInUseBlock(set,_journalTable,_value);
            }
     
    by passing my own values to override its function.
     
    Can you help in that?
     
    Thanks
    H
  • Martin Dráb Profile Picture
    233,529 Most Valuable Professional on at
    Get current record value from Class Method using COC
    We can't give you an answer, because you failed to give us almost any information.
     
    There is no universal meaning for "a current record in a class". It all depends on what class it is, which data you're interested in and which method you're trying to extend.
     
    Many classes are not related to tables at all. Many don't have any meaning of a "current" record. Many work multiple tables, therefore you'll need to decide which one you're interested in. And so on...
     
    If you want an answer, you must give us more details about your particular scenario.
  • Hisham Alsayed Profile Picture
    750 on at
    Get current record value from Class Method using COC
     
     
    I've reviewed a blog post before drafting my message, but it seems to focus solely on illustrating the method structure rather than how to obtain the current record from a method class using COC. If anyone has a snippet of code demonstrating this aspect, I would greatly appreciate it if you could share it.
     
    Thank you.
    H
     
     
     
  • Suggested answer
    MuthukumaranAX Profile Picture
    2,901 on at
    Get current record value from Class Method using COC
  • Waed Ayyad Profile Picture
    8,430 Super User 2025 Season 1 on at
    Get current record value from Class Method using COC
    Hi Hisham,
     
    Do you mean you have class? and you want to make an extension of class method?
    Can you share more details? Which record do you want to get its value?
     
     
    Thanks,
    Waed Ayyad

     
     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
Martin Dráb Profile Picture

Martin Dráb 353 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 276

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 190 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans