Skip to content

Instantly share code, notes, and snippets.

@beeporama
beeporama / ePay Invoice deletion.sql
Created December 19, 2018 18:47
ePay Invoice deletion
--------------------------------------------------------------------------------------------------
-- To remove a normal Invoice from the ePay database, you need to delete from three tables:
-- Invoice, InvoiceEntry, and InvoicePayment. However, our users might not know the exact
-- InvoiceNumber(s) you need, so you might need to recover them based on the customer and
-- "Voucher Number" (which is BatchNumber in the database).
--------------------------------------------------------------------------------------------------
DECLARE @InvoiceID uniqueidentifier, @InvoiceNumber nvarchar(30), @BatchNumber nvarchar(25), @Amount decimal (19,2), @CustomerNumber nvarchar(25), @CustomerName nvarchar(65);
DECLARE curInvoiceID CURSOR LOCAL FAST_FORWARD FOR
[SysODataActionAttribute("CalcMaintenanceDuration", true)]
public int CalculateMaintenanceDuration()
{
//do something
return 0;
}
@beeporama
beeporama / Catch CLR errors in X++ in Dynamics 365 for Operations.xpp
Created May 18, 2017 14:54
Catch CLR errors in X++ in Dynamics 365 for Operations
System.Exception e;
InteropPermission interopPermission;
try
{
interopPermission = new InteropPermission(InteropKind::ComInterop);
interopPermission.assert();
// REST OF CODE THAT MIGHT GENERATE A CLR ERROR
}
catch (Exception::CLRError)
@beeporama
beeporama / PutDimension.xpp
Last active April 20, 2017 19:39
PutDimension - X++ dimension updater
/// <summary>
/// Generic dimension updater. Call this with the DefaultDimension of any table, and update that table’s DefaultDimension with the returned value.
///
/// Sample usage:
/// hcmEmployment.DefaultDimension = xczDimensionHandler::PutDimension(hcmEmployment.DefaultDimension, ‘Favorite_Color’, ’01’);
/// hcmEmployment.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction); // This may or may not be appropriate for your circumstances
/// hcmEmployment.update();
///
/// Based on sample code courtesy Steeve Gilbert.
/// </summary>