Sunday, December 27, 2020
Setting up alert on specific batch job in case of Error or canceled in Dynamics 365 finance and operations
Convert Electronic Reporting outbound documents from Microsoft Office formats to PDF in Dynamics 365 finance and operations
As we aware new feature has been introduced in feature management in Dynamics 365 finance and operations with powerful features. but these features has been not enabled by default.
Recently we have received a power full feature which coverts all electronic reporting outbound documents from Microsoft Office formats to PDF in Dynamics 365 finance and operations.
Go to System administration > Workspaces > Feature management and enable "Convert Electronic Reporting outbound documents from Microsoft Office formats to PDF" feature
Monday, December 21, 2020
Get default dimension name and description in Dynamics 365 finance and operations
I had requirement to get default dimension for Main account and when I look at internet I could see all of them are so complex to get dimension name and description especially description.
In fact we don't need all of them because in out of the box we have view which gives all this info by just one select query. if we have Default dimension and dimension.
This view has method DefaultDimensionView.dimensionDiscription() which gives dimension description.
Please code for your reference, hope you find this useful!
public static void main(Args _args)
{
#define.DimensionName("Department");
DefaultDimensionView DefaultDimensionView;
select firstonly DefaultDimensionView
where DefaultDimensionView.Name == #DimensionName
&& DefaultDimensionView.DefaultDimension == 5637451520;//RecId of default dimension
info(strFmt('Dimension Name: %1, Dimension description:%2', DefaultDimensionView.DisplayValue, DefaultDimensionView.dimensionDiscription()));
}
Error settlement of Payments after removing AMC banking ISV solution.
Our client uses AMC banking ISV solution for past 3 year and now they thought to quite and use existing features in out of the box with few customizations in case of out going payments as well as incoming payments.
For outgoing payments we have "MultiCash (PL)" but its text file but client required in "ISO 20022 credit transfer", hence we have derived standard format and built new.
For incoming payments we have used "ISO20022 camt.054" and for advance bank reconciliation we have used "ISO20022 camt.053" with few minor changes in format and model mapping.
Everything was fine but finally we had an issue with settlement of customer or vendor payments. all the open transactions marked as "In use", hence we are not able to settle any transactions.
and we don't see any pending customer / vendor payment journals in the system.
As everyone aware we need to remove reference in SpecTrans table hence I have built following script, may be you can find it useful if you face similar issues.
Once we ran this script then we are able to settle all the transactions which are struck in use.
public void clicked()
{
SpecTrans specTrans;
CustTransOpen custTransOpen;
VendTransOpen vendTransOpen;
CustTrans custTrans;
VendTrans vendTrans;
container conCustInvoice, conVendInvoice;
int totalCustInvoices, totalVendInvoices;
if(Box::yesNo('@JP:DeleteAllSpecTransForPoland', DialogButton::Yes) == DialogButton::Yes)
{
changecompany('<Legal Entity>')
{
ttsbegin;
while select specTrans join custTransOpen
where CustTransOpen.DataAreaId == specTrans.RefCompany
&& CustTransOpen.RecId == specTrans.RefRecId
&& CustTransOpen.TableId == specTrans.RefTableId
join custTrans
where custTrans.RecId == custTransOpen.RefRecId
&& custTrans.AccountNum == custTrans.AccountNum
{
if (!conFind(conCustInvoice, custTrans.Invoice))
{
conCustInvoice += custTrans.Invoice;
}
totalCustInvoices++;
}
info(con2Str(conCustInvoice));
info(strFmt('@JP:TotalSpecTransRecordsDeletedForCustomer', totalCustInvoices));
specTrans.skipDeleteActions(true);
specTrans.skipDatabaseLog(true);
specTrans.skipEvents(true);
specTrans.skipDataMethods(true);
delete_from specTrans exists join custTransOpen
where CustTransOpen.DataAreaId == specTrans.RefCompany
&& CustTransOpen.RecId == specTrans.RefRecId
&& CustTransOpen.TableId == specTrans.RefTableId;
while select specTrans join vendTransOpen
where vendTransOpen.DataAreaId == specTrans.RefCompany
&& vendTransOpen.RecId == specTrans.RefRecId
&& vendTransOpen.TableId == specTrans.RefTableId
join VendTrans
where VendTrans.RecId == vendTransOpen.RefRecId
&& VendTrans.AccountNum == vendTransOpen.AccountNum
{
if (!conFind(conVendInvoice, vendTrans.Invoice))
{
conVendInvoice += vendTrans.Invoice;
}
totalVendInvoices++;
}
specTrans.skipDeleteActions(true);
specTrans.skipDatabaseLog(true);
specTrans.skipEvents(true);
specTrans.skipDataMethods(true);
delete_from specTrans exists join vendTransOpen
where vendTransOpen.DataAreaId == specTrans.RefCompany
&& vendTransOpen.RecId == specTrans.RefRecId
&& vendTransOpen.TableId == specTrans.RefTableId;
info(con2Str(conVendInvoice));
info(strFmt('@JP:TotalSpecTransDeletedForVendor', totalVendInvoices));
info("@JP:OperationCompleted");
ttscommit;
}
}
else
info("@JP:OperationCancelled");
}
Wednesday, July 15, 2020
Script to mark a years worth of bank transactions as cleared for bank reconciliation in Dynamics 365 finance and operations
public static class JP_SupportScripts
{
public static void autoReconcilation(TransDate _accountStatementDate, BankAccountStatementNum _accountStatementNum, CompanyBankAccountId _accountId)
{
BankAccountStatement bankAccountStatement;
BankAccountTrans bankAccountTrans, bankAccountTransUpdate;
BankAccountTable bankAccountTable;
int noOfRec;
ttsbegin;
select firstonly bankAccountTable
exists join bankAccountTrans
where bankAccountTrans.AccountId == bankAccountTable.AccountID
&& bankAccountTable.AccountID == _accountId
&& bankAccountTrans.Reconciled == NoYes::No
&& bankAccountTrans.AccountStatementDate == Global::dateNull()
&& bankAccountTrans.AccountStatement == "";
if (bankAccountTable.RecId)
{
if(Box::yesNo(strFmt("Do you want to reconcile all the transaction for the bank %1", bankAccountTable.AccountID), DialogButton::Yes) == DialogButton::Yes)
{
bankAccountStatement.AccountId = _accountId;
bankAccountStatement.AccountStatementDate = _accountStatementDate;
bankAccountStatement.AccountStatementNum = _accountStatementNum;
bankAccountStatement.CurrencyCode = bankAccountTable.CurrencyCode;
bankAccountStatement.EndingBalance = bankAccountTable.balanceCur();
bankAccountStatement.insert();
while select forupdate bankAccountTransUpdate
where bankAccountTransUpdate.Reconciled == NoYes::No
&& bankAccountTransUpdate.AccountId == bankAccountTable.AccountId
&& bankAccountTransUpdate.AccountStatementDate == Global::dateNull()
&& bankAccountTransUpdate.AccountStatement == ""
{
bankAccountTransUpdate.Included = NoYes::Yes;
bankAccountTransUpdate.AccountStatement = bankAccountStatement.AccountStatementNum;
bankAccountTransUpdate.AccountStatementDate = bankAccountStatement.AccountStatementDate;
bankAccountTransUpdate.update();
noOfRec++;
}
info (strFmt("Bank statemant '%1' created with %2 transactions", _accountStatementNum, noOfRec));
}
}
else
info(strFmt('No transactions to reconcile for bank %1', _accountId));
ttscommit;
}
}
This script will create account statement with ending balance for the provided bank account and reconciles all the transactions.
Hope this helps , I will come-up with another interesting blog post soon, till then happy daxing :)