最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

FormObservableLink在数据源扩展中起作用 / FormObservableLink works in data source extensions

网络文摘 William 853浏览 0评论
FormObservableLink class is useful for refreshing display and edit methods in D365FO. You create an instance variable of FormObservableLink type in a form, initialize it and call its observe() method in display/edit methods that you need to refresh on demand. When the refresh is required, you call markChanged() method of FormObservableLink and the system will rerun the methods and display new values. You can find more details in AX 7. Display methods and Form Observability, for instance. I wondered if I can do the same in a data source extension and I wasn’t really should that it would work. But it does – and the implementation is virtually the same as when building a whole form. Here is a simple example:
[ExtensionOf(formDataSourceStr(smmContactPerson, ContactPerson))]
final class MySmmContactPerson_ContactPersonDs_Extension
{
    // Declare and initalize FormObservableLink
    private FormObservableLink observableLink = new FormObservableLink();
 
    edit NoYes myMethod(boolean _set, ContactPerson _contactPerson, NoYes _newValue)
    {
        // This says that observableLink will be able to refresh myMethod()
        observableLink.observe();
 
        ....
    }
 
    void refreshMethodsWhenSomethingHappened()
    {
        // Here we trigger a refresh
        observableLink.markChanged();
    }
}
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址