Skip to main content
Dynamics 365 Community / Forums / Finance forum / Get current record val...
Finance forum
Suggested answer

Get current record value from Class Method using COC

editSubscribe (1) ShareShare
ReportReport
Posted on by 723
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
Attachments
  • Martin Dráb Profile Picture
    Martin Dráb 222,646 Super User 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 723 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 222,646 Super User 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 723 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 222,646 Super User 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 723 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 222,646 Super User 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 723 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,893 on at
    Get current record value from Class Method using COC
  • Waed Ayyad Profile Picture
    Waed Ayyad 1,996 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

     
     

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,126 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,646 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans