K
K
kalapanga2020-04-02 16:06:18
1C
kalapanga, 2020-04-02 16:06:18

How to programmatically write down the address of the counterparty in 1C and add it to the history of address changes?

I am interested in Enterprise Accounting and Trade Management, but for definiteness I will talk about Accounting 3.0 of the current version.
The task is this. There is a competitor. He has a legal address. I need to programmatically change it, but so that the changes are displayed in the address change history. So that the old one remains, and a new one appears with the beginning of the action from the current date. I'm trying to do it like this:

МойКонтрагент = Справочники.Контрагенты.НайтиПоНаименованию("НаименованиеМоегоКонтрагента");
НовыйАдрес = "Тут реальный корректный адрес";
Вид = Справочники.ВидыКонтактнойИНформации.ЮрАдресКонтрагента;
УправлениеКонтактнойИнформацией.ДобавитьКонтактнуюИнформацию(МойКонтрагент, НовыйАдрес, Вид, ТекущаяДата(), Ложь);

The last parameter - False/True did not fundamentally affect the result.
The address changes, but only the current record changes. Nothing is added to history.
I found out that the type of contact information has the attribute "Keep the history of changes" - in the database it is "No" for all types. Is it related to my issue? I understand that no. Since in the counterparty card and without this attribute, there is a History link near the address, if you click it, the Address History form opens, where you can easily add an address and specify the validity dates. But this form, if I understand correctly, directly edits the tabular part of the History of Contact Information of the counterparty.
Debugging came from Contact Information Management. Add Contact Information to Contact Information Management Service. Add Contact Information. I saw this check:
Периодическая = УправлениеКонтактнойИнформациейСлужебныйПовтИсп.КонтактнаяИнформацияОбъектаСодержитКолонкуДействуетС(Объект.Ссылка);

According to it, it turns out that the contact information of the counterparty is not Periodic at all. (By the way, there is a column Valid C in Trade).
On this I broke down and ask for the help of the club. Is it really necessary to disassemble the two tabular parts of the counterparty yourself, analyze the validity periods, add a line. Maybe there is a ready-made procedure / function for this, but I didn’t find it and use something wrong?

ps Something I missed the most obvious example. Processing LoadingAccountsFromFile. Contact information is recorded there using AddContactInformation. Everything is clear here, everything is fine.
But I didn’t find anything to work with the history of the address, but I need to. It's strange somehow. We'll probably have to invent our own bicycles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2020-04-02
@fosihas

The correct clarification in which conf you will write, tk. there are differences in the structure and recording methods.
Yes, use the BSP procedures. This will make life easier.
but....
In that case I recommend to catch a debugger that happens.
You are doing everything according to the procedure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question