Showing posts with label userConnection. Show all posts
Showing posts with label userConnection. Show all posts

Monday, April 26, 2021

UserConnection in D365fo

Its used when we need to commit our transaction wehen standared code doesn't Commit.
example :SalesQuotationEditLinesForm_Sales_Send > checkSales() , COC and try to write 
custom insert or update operation here while validation is failed our transactions doesn't commit

static void KlForRecordInserted(Args _args)
{
    UserConnection userConnection;
    CustTable custTable;
    ;
   
    ttsbegin;
   
    userConnection = new userConnection();
   
    custTable.clear();
    custTable.initValue();
    custTable.AccountNum = "000020";
    custTable.Name = "My Test Customer";
    custTable.setConnection(userConnection); // set userconnection
    custTable.insert();
   
    throw error("An error that causes a rollback");
    ttscommit;
}

Table browser URL in D365FO

Critical Thinking icon icon by Icons8