Показать сообщение отдельно
Старый 18.04.2019, 22:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
D365: Bug in Payment method lookup in Expense report form
Источник: http://alexvoy.blogspot.com/2019/04/...lookup-in.html
==============

You cannot select a payment method in an Expense report line, if you opt for any category containing comma separated value.



There is a bug in standard TrvExpenseLookupHelper class in paymentMethodLookupQuery method: it must use old good queryValue() method.


Otherwise you will get a few values instead of one in the range. Compare them before and after the fix.



[ExtensionOf(classStr(TrvExpenseLookupHelper))]
final static class avrTrvExpenseLookupHelper_Extension
{
///
/// A fix for the standard method which does not treat comma separated cost type correctly
///
///
///
///
public static Query paymentMethodLookupQuery(TrvCostTypeEDT _costType, boolean _excludeImportOnly)
{
Query query = next paymentMethodLookupQuery(_costType, _excludeImportOnly);
QueryBuildDataSource qbPayMethod, qbValidatePayment;
TrvCostType trvCostType;

trvCostType = TrvCostType::find(_costType);

query = new Query();

qbPayMethod = query.addDataSource(tableNum(TrvPayMethod));

if (trvCostType)
{
query.queryType(QueryType::Join);

qbValidatePayment = qbPayMethod.addDataSource(tableNum(TrvValidatePayment));
qbValidatePayment.addLink(fieldNum(TrvPayMethod,PayMethod),fieldNum(TrvValidatePayment,PayMethod));
qbValidatePayment.joinMode(JoinMode::ExistsJoin);
//it should be converted by standard queryValue()
qbValidatePayment.addRange(fieldNum(TrvValidatePayment, CostType)).value(queryValue(trvCostType.CostType));
}

if (_excludeImportOnly)
{
QueryBuildRange qbr = qbPayMethod.addRange(fieldNum(TrvPayMethod, AutomaticPayment));
qbr.value(queryValue(NoYes::No));
qbr.Status(RangeStatus::Hidden);
}

return query;
}

}




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