DefaultAccount value setting

The 1C:Enterprise developers forum

People who like this:1Yes/0No
Just came
Rating: 0
Joined: Jan 27, 2021

I got stuck in episode 2 of Hachatlon 2. I need to set the default Account value setting for the Expense document with the document form open. I thought of using the OnOpen function for this and I got the value from the DefaultAccount constant but it didn't work. I tried different ways but I cannot pass. Thank you. :)

Download 1c.png (214.4 KB)
Download 1ci.png (183.61 KB)
Download hata.png (22.62 KB)
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 2, 2020

Thank you for the nicely organized question. Please check the following points:
1-Please try to use the standard form event OnCreateAtServer (it runs on server WITH context so that the requisites of the form are accessable) for assigning values to the requisites of the form (generally, you should assign the values of the requisites of the from  in the server side, and the assigned value will show up automatically on the client side of the form). Obviously, you have to use the module of the form, and not the object module (which you have already used correctly).
2-You are calling a function from the common module DefaultAccountValue.  Please check that this common module is working on server (from the properties dialog of the common module make sure that there is a tick on "Server", while Client shouldn't be ticked).
3-Debug putting the red dot on the line DefaultAccountValue.Value() in order to be sure that the function is returning the needed Account.
4-Lastly, name of your function "Value" is quite a generic name. In some instances when a function, variable etc. you have created and named has the the same name with a built in method, object name, requisite etc, you can get an error. Moreover, when you check your code later or when another programmer is reading your code, vague names such as "value" do not help understand what is going on with the code. So i would advise that you try to use more informative, elaborate names for your functions, variables etc.

Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.