AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.10.2014, 02:18   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
goshoom: Delete order line through AIF
Источник: http://dev.goshoom.net/en/2014/10/de...e-through-aif/
==============

The following code sample shows how to delete a line of an existing sales order through AIF from outside Dynamics AX 2012 . It uses a partial update, which means that we don’t have to send the whole document back to AX. As the documentation says, we have to include just the fields to change (none in my case) and “any fields required by the document” – that’s why I included fields such as PurchOrderFormNum. Note that you may have different fields set as mandatory.

Also notice how action properties are specified – we’re deleting the line, which means updating the order.

static void Main(string[] args){ using (SalesOrderServiceClient client = new SalesOrderServiceClient()) { EntityKey[] entityKeyList = EntityKeyForSalesId("SO00001"); // Get the order to modify var order = client.read(new CallContext(), entityKeyList); // For demo, always the last order line is deleted var lastLine = order.SalesTable[0].SalesLine.Last(); var salesLine = new AxdEntity_SalesLine() { RecId = lastLine.RecId, RecIdSpecified = true, SalesUnit = lastLine.SalesUnit, action = AxdEnum_AxdEntityAction.delete, actionSpecified = true }; var salesTable = new AxdEntity_SalesTable() { _DocumentHash = order.SalesTable[0]._DocumentHash, PurchOrderFormNum = order.SalesTable[0].PurchOrderFormNum, ReceiptDateRequested = order.SalesTable[0].ReceiptDateRequested, action = AxdEnum_AxdEntityAction.update, actionSpecified = true, SalesLine = new[] { salesLine } }; AxdSalesOrder newOrder = new AxdSalesOrder() { SalesTable = new[] { salesTable } }; // Update the order client.update(new CallContext(), entityKeyList, newOrder); } } // Helper methodprivate static EntityKey[] EntityKeyForSalesId(string salesId){ KeyField field = new KeyField() { Field = "SalesId", Value = salesId }; EntityKey key = new EntityKey() { KeyData = new[] { field } }; return new[] { key };}








Источник: http://dev.goshoom.net/en/2014/10/de...e-through-aif/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
goshoom: Creating sales orders via AIF in AX2012 Blog bot DAX Blogs 0 22.01.2014 02:14
dynamicsaxtraining: Vendor returns Blog bot DAX Blogs 0 11.10.2012 00:11
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
dynamicsaxtraining: Quality management Blog bot DAX Blogs 0 12.02.2011 00:11
dynamicsaxtraining: Create purchase order Blog bot DAX Blogs 0 14.12.2009 14:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:39.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.