Skip to main content

Notifications

Announcements

No record found.

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

Update the value of contract field

(3) ShareShare
ReportReport
Posted on by 6,424
Hello,
On one of the contract dialogs, we need to add new field. let's call it "DescriptionField".
On the dialog, we also have a lookup field where we select the mode of delivery.
What I want to achieve is that, by selecting (or modifying) the mode of delivery value, new DescriptionField must be automatically updated with the value... eg. "ModeOfDelivery + Date".
How can I achieve it and where should my code be placed?
We have Controller, Contract, Service and UIBUilder classes
Categories:
  • Layan Jwei Profile Picture
    Layan Jwei 7,484 Super User 2024 Season 2 on at
    Update the value of contract field
    Hi,

    Does this ISV class already has code for the modified method, if yes then you can add code to it directly?
    if not, then as a workaround, maybe create a new variable and try and define in the postBuild method and use it instead in the postRun method?
    but this might cause issues in the future, if the ISV add code to the modified method maybe -- so maybe it's better to contact them
     
    dialogField dialogDeliveryMode;
    
    public void postBuild()
    {
        dialogDeliveryMode = this.bindInfo().getDialogField(this.dataContractObject(), methodstr(YourContractClass,parmDeliverMode));
    }
    
    

    can u share the ISV class with us?
  • Johnny Profile Picture
    Johnny 6,424 on at
    Update the value of contract field
    Hi Layan,
    it is an ISV class.
  • Layan Jwei Profile Picture
    Layan Jwei 7,484 Super User 2024 Season 2 on at
    Update the value of contract field
    Hi Johnny,

    What's the standard class name u are trying to create an extension for?
  • Johnny Profile Picture
    Johnny 6,424 on at
    Update the value of contract field
    Hi Layan,
    thanks for the solution.
    It works if I put the code in the same class where "Payment mode" dialogField is defined. But I have to use the extension of the UIBuilder class.
    In original UIBuilder class paym mode is defined as private "private DialogField dialogPaymMode;".
    How could I reach this private veriable? Or what would be a workoaround for extension?
    Thanks
  • Layan Jwei Profile Picture
    Layan Jwei 7,484 Super User 2024 Season 2 on at
    Update the value of contract field
    Hi,

    Is your issued fixed? if yes, then please verify the answer if it helped.
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,484 Super User 2024 Season 2 on at
    Update the value of contract field
    Hi Johnny,


    So you want whenever you modify the mode of delivery field, then the description needs to be populated with sth.

    So you need to registerOverride the modified method of the Mode of delivery field in the postRun method in the ui builder class, and inside the method you can set the values.
     
    So maybe sth like that:
     
     
    public void postRun()
    {
        super();
    
        // Override modified method
        dialogDeliveryMode.registerOverrideMethod(methodStr(FormStringControl, modified),methodStr(UIBuilderClass, deliveryMode_modified),this);
    }
    
    private boolean deliveryMode_modified(FormStringControl _control)
    {
        this.modifyDialogFields();
    
        return _control.modified();
    }
    
    private void modifyDialogFields()
    {
        dialogDescription.value(//put the value u want here);
    }
     

    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! 🥳

Share Your Event with the Community

Jump start your event engagement! 📢

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,646 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans