I
I
Ivan Melnikov2019-05-14 11:18:06
1C-Enterprise
Ivan Melnikov, 2019-05-14 11:18:06

What is the reason for the error "Value is not a value of an object type (Production)"?

1C:Enterprise 8.3 (8.3.11.2867), SCP 1.3 (1.3.116.2), regular application, client-server.
We transferred the database to another 1C platform of the same version, and at the time of posting the document Requirement-invoice , an error began to fall out:
5cda784d137af451994383.png
As I understand it, the error falls out at the time of accessing the first line of the tabular part Products :

Если Источник.ДокументОснование.Продукция[0].Номенклатура.Печать = 1 Тогда

This code is located in the common module, which is assigned as the event handler for the Posting Processing event for the Invoice Requirement document .
How can this be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kinash, 2019-05-14
@immelnikoff

Variants of the error at this point:
1) The DocumentBase field is not filled - correct by checking the value.
2) The DocumentBase field is filled, but with a type of document that does not have a tabular part of the Production - fix it by checking the type of the base
3) The base has a tabular part of the Production, but there are no values ​​- before accessing the rows, you need to check for their presence.
You seem to have the second error, but maybe the first. The third error will generate a message about access outside the index.
By the way, there may still be a problem when accessing the Print property if the Nomenclature is a complex type, and not just a reference to a reference book.
In general, you need to check. Something like this:

Если ТипЗнч(Источник.ДокументОснования) <> Тип("ДокументСсылка.ЗаказНаРазработку") Тогда
  Возврат;
ИначеЕсли Источник.ДокументОснования.Продукция.Количество() = 0 Тогда
  Возврат;
КонецЕсли;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question