Warm tip: This article is reproduced from serverfault.com, please click

initialize value of edit method in init method of form

发布于 2020-10-26 10:48:00

I want to initialize a value of an edit method inside the init method of form, i wrote this:

[Form]
public class foo extends FormRun
{
    str                                      paymTermId;


   public void init()
   {
      
       CustTable custTable = CustTable::find("DE-001");

       paymTermId = custTable.paymTermId;                          
       super();
   }

    edit str edtpaymTermId(boolean set, str _paymTermId)
    {

        if (set)
        {
             paymTermId= _paymTermId;
        }
        return paymTermId ;
    }
 }

But when i open the form the control remains empty.

any suggestions?

Questioner
OiRc
Viewed
0
FH-Inway 2020-11-04 18:10:54

I tried to reproduce the issue, but was not successful. For me, when opening the form, the control shows a value.

A possible reason why it is not working for you could be that you open the form in the wrong company. In your code, you retrieve the value to display in the control from the payment term of customer DE-001. This customer exists in company USMF in the Contoso demo data and has payment term Net10. If the form is opened in this company, the value is shown in the control. If you are in another company (e.g. DAT), no value is shown.

enter image description here