A
A
Alexey2015-12-18 10:05:40
1C
Alexey, 2015-12-18 10:05:40

How to remove changes from exchange plans?

Hello everyone, such a problem: I can not delete changes from exchange plans. I am writing my integration 1c-> Bitrix. Found the Exchange Plans.DeleteRegistrationChanges method. But here for some reason the method refuses to delete. Automatic registration of changes is set. The code below is executed already at the end of the exchange, when 1s receives a response from Bitrix

//Выборка - Массив контрагентов состоящий из xmlID и bitrixID
                        Узел = ПланыОбмена.ОбменССайтом.ЭтотУзел();
      Для Каждого Элемент Из Выборка Цикл
        УИД = Новый УникальныйИдентификатор(Элемент["XmlID"]);
        Ссылка = Справочники.Контрагенты.ПолучитьСсылку(УИД);
        Объект = Ссылка.ПолучитьОбъект();
          Если ПустаяСтрока(Объект.id) ИЛИ Объект.id <> Элемент["bitrixID"] Тогда
            Объект.id = Элемент["bitrixID"];
            Объект.Записать();
            ПланыОбмена.УдалитьРегистрациюИзменений(Узел, Ссылка);
          КонецЕсли;
      КонецЦикла;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Gusev, 2015-12-18
@alexeyshi

You are choosing the wrong node for the exchange.
ThisNode - returns a link to the node of the current infobase, and registration is carried out in nodes that represent other infobases.
You need something like Exchange Plans.ExchangeSite.FindByCode(); and transfer there the code of the exchange node impersonating the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question