Показать сообщение отдельно
Старый 27.03.2017, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxhints: What is wrong: crossCompany update job in AX 2012
Источник: http://dynamicsaxhints.blogspot.com/...pdate-job.html
==============

I want to challenge you today to find an error in the following update job. Do not pay attention on the functional part. I agree, the job can be rewritten, but let's assume it must be done this way.
static void crossCompanyUpdate(Args _args)
{
CustTable custTable;
CustGroup custGroup;
PaymTermId oldPaymTermId = 'Net10', newPaymTermId = 'Net11';

ttsBegin;

// find all companies with oldPaymTermId
while select crossCompany custGroup
group by custGroup.dataAreaId
where custGroup.PaymTermId == oldPaymTermId
{
changeCompany(custGroup.dataAreaId)
{
// disable update method
custTable.skipDataMethods(true);

// set newPaymTermId
update_recordSet crossCompany custTable
setting PaymTermId = newPaymTermId
where custTable.PaymTermId == oldPaymTermId;
}
}

ttsCommit;
}
Post your ideas into comments. I will open comments and post my solution in one week. Have fun :-)

Источник: http://dynamicsaxhints.blogspot.com/...pdate-job.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.