Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > DefaultAccount value setting

Forum

Search UsersRules
DefaultAccount value setting
#1
Just came
Points:: 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. :)

Profile
#2
Just came
Points:: 0
Joined:: Dec 2, 2020

Hello!
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.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.