Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Get current record value from Class Method using COC

Posted on by 739
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
    Martin Dráb 229,275 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
    Hisham Alsayed 739 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
    Martin Dráb 229,275 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
    Hisham Alsayed 739 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
    Martin Dráb 229,275 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
    Hisham Alsayed 739 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
    Martin Dráb 229,275 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
    Hisham Alsayed 739 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
    MuthukumaranAX 2,899 on at
    Get current record value from Class Method using COC
  • Waed Ayyad Profile Picture
    Waed Ayyad 5,955 Super User 2024 Season 2 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans