Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > DocumentForm -> DynamicList -> RecordForm

Forum

Search UsersRules
DocumentForm -> DynamicList -> RecordForm
#1
Active user
Points:: 0
Joined:: Sep 18, 2012

Hello everyone,
I have DocumentManagedForm and this form has an DynamicList attribute where InformationRegister is given as a base data (acutally CustomQuery but InformationRegister is base table). When I try to add record to this InformationRegister in DocumentForm, RecordForm opens of course. One of attributes of InformationRegister is Document.Ref. I would like to have this attribute filled with value of Document.Ref when I try to add record from DocumentManagedForm and RecordForm is opened. I don't know how to do it. Would you help me?
I tried to find something like FormOwner for RecordForm (I thought that maybe DocumentForm is the FormOwner) but without result. I tried also some other things but it doesn't work. Would you have any idea how to do it?
Thank you in advance for your help.
Kris

Profile
#2
Interested
Points:: 15
Joined:: Oct 27, 2011

You can use custom handler to open form and add some Parameters (for example DocRef) and use this parameters in OnCreateAtServer event of the record form.
There could be an easier way... But my way should work 100%

Profile
#3
Active user
Points:: 0
Joined:: Sep 18, 2012

I have added parameter DocRef to OnOpen handler of DocumentForm, where Zaopatrzenie is a DynamicList of Information Register and in CustomQuery of DynamicList parameter is used to filter records and it works fine.

Code
Procedure OnOpen(Cancel)
      
    ThisForm.Zaopatrzenie.Parameters.SetParameterValue("DocRef",Object.Ref);   
   
EndProcedure


But later I add the record to Zaopatrzenie and the RecordForm is open and OnCreateAtServer of this form is executed and I don't know how to use this parameter here. The RecordForm is form of InformationRegister and it cannot see the parameter of DocumentForm (or I cannot find it). I don't know how the RecordForm should know where it is open from (i.e. from DocumentForm or from InformationRegisterList). If it is open from DocumentForm then DocRef should fill the attribute of record in RecordForm using parameter. That's my problem. Maybe I don't understand, maybe I do something wrong, so I will be thankful if you explain me. If more details will be necessery please just let me know.

Profile
#4
Active user
Points:: 0
Joined:: Sep 18, 2012

Problem solved:

Code
   
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   Zaopatrzenie.Parameters.SetParameterValue("DocRef",Object.Ref);
   FilterItem = Zaopatrzenie.Filter.Items.Add(Type("DataCompositionFilterItem"));
   FilterItem.LeftValue = New DataCompositionField("DocRef");
   FilterItem.RightValue = Object.Ref;
   FilterItem.Use = True;
   FilterItem.ComparisonType = DataCompositionComparisonType.Equal;    
EndProcedure


and in DocRef attribute in InformationRegister I had to check "Fill with data..." in Properties

Profile
#5
Interested
Points:: 15
Joined:: Oct 27, 2011

I am glad you figured it out.

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.