Skip to main content

Notifications

Announcements

No record found.

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

Display method value on to a field

(0) ShareShare
ReportReport
Posted on by 107
Hi,
I have a display method control on one form: TestDisplay()
I have field on another form TestField. 
I need the values from display method to appear on that field. 
Both are from same table.

How can I get values from display method to store into a field?
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,493 Super User 2024 Season 2 on at
    Display method value on to a field
     
    Try to use edit method, maybe it handles your case:
     
     
    public edit ReasonCode editBlockedReasonCode(boolean set, ReasonCode _reasonCode)
        {
            VendOnHoldHistory vendOnHoldHistory;
    
            if (set)
            {
                ttsbegin;
                vendOnHoldHistory = VendOnHoldHistory::find(this.AccountNum, true);
                vendOnHoldHistory.ReasonCode = _reasonCode;
                vendOnHoldHistory.update();
                ttscommit;
            }
            else
            {
                _reasonCode = VendOnHoldHistory::find(this.AccountNum).ReasonCode;
            }
    
            return _reasonCode;
        }
    Thanks 
    Waed Ayyad
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    Display method value on to a field
    First thing is a display method value is generated on run time. Means when form is rendered to user, then only it will generate. So, to use a display method like your field, you need to make some batch job to run, or if it is possible, then via form datasources you can get the value. If this is also not possible, then you can write code in init in such a way that you should use same select statement like what the display method is using.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Display method value on to a field
    Hi RSX,
     
    If you need a field in the database, you can go for a table extension with help of development. In case you now only have a display method on the form, you can create a runnable class and copy the code of the form display method and use it in the runnable class. 
  • RSX Profile Picture
    RSX 107 on at
    Display method value on to a field
    Hi Andre, I want the value in display method to become a field in data base. 

    Layan, I've tried that in the init method of the form, but it is not working. It shows blank values only. 
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Display method value on to a field
    Hi,
     
    You would need to decide if the value in the display method should become a field in the database or if you then will store redundant data. In case you have a requirement to have the same display method on different forms, you can also create the display method on the table. Then on both the forms, you have the same calculation for the display field.
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    Display method value on to a field
    Hi Community User,
     
    Did you try to put on the init method of the form
    Table.Field = Table.displayMethod()?
     
    And if the value of the display method might change while the form is open, then what values does this display method depend on? Is it on fields in the same table? Then maybe add the same logic in modified methods of those fields

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans