Skip to content

Instantly share code, notes, and snippets.

View d47447's full-sized avatar

Deepak Agarwal d47447

View GitHub Profile
@d47447
d47447 / gist:b26a8790f9e30834b2467296c5ba7cb1
Created April 20, 2026 14:39
CrossCompany GL Import LedgerJournalEntity
public static container copyCustomStagingToTarget(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution)
{
container con = next copyCustomStagingToTarget(_dmfDefinitionGroupExecution);
LedgerJournalEntityStaging staging;
LedgerJournalTrans ledgerJournalTrans;
ttsbegin;
ledgerJournalTrans.skipDataMethods(true);
while select forupdate ledgerJournalTrans
@d47447
d47447 / D365FO Authentication
Created November 13, 2025 15:36
Bicep - Azure function app
[FunctionName("GetToken")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req,
ILogger log)
{
var client = new HttpClient();
var body = new Dictionary<string, string>
{
{ "client_id", "<your-client-id>" },
{ "client_secret", "<your-client-secret>" },
@d47447
d47447 / processMsg
Created June 27, 2025 14:33
Custom web service in D365FO - Part-II
public TheAxaptaResponseContract processMsg(TheAxaptaRequestContract _request)
{
TheAxaptaResponseContract response = new TheAxaptaResponseContract();
try
{
str storeId = _request.parmStoreNumber();
str trackingNumber = _request.parmTrackingNumber1();
// Example: Validate store ID
if (storeId == "")
{
[ExtensionOf(classStr(CustFreeTextInvoicePostedBusinessEventContract))]
internal final class CustFreeTextInvoicePostedBusinessEventContractMyModel_Extension
{
// contract extension state
private str customerClassification;
protected void initialize(CustInvoiceJour _custInvoiceJour)
{
next initialize(_custInvoiceJour);
customerClassification = 'StandardCustomer';
@d47447
d47447 / TheAxaptaRequestContract
Created March 31, 2025 10:30
Web API Classes
[DataContractAttribute]
public class TheAxaptaRequestContract
{
private boolean isShipped;
private String255 dataAreaId;
private String255 storeNumber;
private String255 trackingNumber1;
[DataMember("TrackingNumber1")]
public String255 parmTrackingNumber1(String255 _trackingNumber1 = trackingNumber1)
@d47447
d47447 / TheAxaptaCellBackground
Created November 13, 2023 12:17
TheAxaptaCellBackground
using OfficeOpenXml;
using OfficeOpenXml.Style;
internal final class TheAxaptaExcelExportWithColor
{
/// <summary>
/// Class entry point. The system will call this method when a designated menu
/// is selected or when execution starts and this class is set as the startup class.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
@d47447
d47447 / Barcode printing
Last active December 20, 2022 13:58
Barcode printing
display BarCodeString getBarCode()
{
Barcode barcode;
barcode = Barcode::construct(BarcodeType::Code39);
barcode.string(true, "Actual value of bar code"); //You can parameterize this value
barcode.encode();
return barcode.barcodeStr();
}
@d47447
d47447 / ValidateDimensionCombination
Created December 13, 2022 09:18
Financial dimension validation
MainAccount mainAccount;
DimensionAttributeValue dimensionAttributeValue;
DimensionAttribute dimensionAttribute;
container dimCon = str2con(myTable.AccountDisplayValue, "-"); // This will break dimension combinaiton into different fields
LedgerAccountValidationContract validationContract;
LedgerAccountContract accountContract;
DimensionAttributeValueContract valueContract;
FinancialDimensionValidationService service;
@d47447
d47447 / autoApproveWF
Last active June 27, 2022 13:14
All about workflow manipulation
public void autoApproveWF(Common _common, str _user)
{
WorkflowWorkItemTable WorkflowWorkItemTable;
select WorkflowWorkItemTable
where workflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem
&& workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
&& WorkflowWorkItemTable.RefTableId== _common.TableId
&& WorkflowWorkItemTable.RefRecId == _common.RecId;
@d47447
d47447 / TableEventMethod
Created April 20, 2022 10:50
TableEventMethods
class Dpk_VendTableEventHandlerClass
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(VendTable), DataEventType::InitializedRecord)]
public static void VendTable_onInitializedRecord(Common sender, DataEventArgs e)