web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Recalculate credit limit on customer

(0) ShareShare
ReportReport
Posted on by 15

Hi,

I am trying to update CustTable with a credit limit from a CSV-file without any luck.

The check for the credit limit with the recalculation popup doesn't return the control and my batch job class stops.

Besides I don't get the popup at all like I did when using ttsbegin/ttscommit.

Also is it possible from my class (always, either run manually or in a batch) to NOT get the popup?

Does anyone know how the log works also, if I show something in the infolog will it be added to the job history?

This is my code. What is wrong?

//try
//{

//ttsbegin;

record = importFile.read();

while(importFile.status() == IO_Status::Ok)
{

record = importFile.read();

if(!record)
break;

custTable.clear();
custAccountNum = conPeek(record,2);
custTable = CustTable::find(custAccountNum,true);
if(custTable)
{
info(strFmt("Customer: %1", custTable.name()));
custCreditLimit = conPeek(record,4);
if(custTable.CreditMax != custCreditLimit) //Check Credit Limit
{

custTable.VATNum = conPeek(record,3);
custTable.CreditMax = custCreditLimit;
this.parmCreditLimit(custTable);
insDateTime = str2datetime(conPeek(record,5) ,321);
updDateTime = str2datetime(conPeek(record,6) ,321);
custTable.update();
}
}
else
{
info("Customer not found");
}

}

//ttscommit;

//}

//catch(Exception::Error)
//{
//Throw(Exception::Error);
//}

public void parmCreditLimit(CustTable _custTable)
{
MenuFunction salesCreditLimitCheck;
Args args;
CustCreditLimit custCreditLimit;
// CustCreditLimit custCreditLimit = new CustCreditLimit(CustTable::find(_custTable.AccountNum));

custCreditLimit = CustCreditLimit::construct(_custTable);
if (custCreditLimit.shouldCheckCreditAvailable() &&
_custTable.existOpenOrders())
{
//Updating estimated value for open sales orders related to the customer.
args = new Args();
args.parm(_custTable.AccountNum);
salesCreditLimitCheck = new MenuFunction(menuitemActionStr(salesCreditLimitCheck), MenuItemType::Action);
if (salesCreditLimitCheck.checkAccessRights())
{
salesCreditLimitCheck.run(args);
}
}
}

Regards Fredrik.

I have the same question (0)
  • MuthukumaranAX Profile Picture
    2,903 on at
    RE: Recalculate credit limit on customer

    just to be clear, your requirement is to update the credit limit in the customer master at the same time recalculate the credit limit. correct?

  • Fredrik Brandt Profile Picture
    15 on at
    RE: Recalculate credit limit on customer

    Yes, that is correct.

  • MuthukumaranAX Profile Picture
    2,903 on at
    RE: Recalculate credit limit on customer

    Kindly check the logic written in the below object and you can follow the same approach

    CustTableChangeProposalApply (class) >> updateEstimatedValueOnSalesOrderRelatedToCustomer (method)

  • Fredrik Brandt Profile Picture
    15 on at
    RE: Recalculate credit limit on customer

    In AX2012?

  • Verified answer
    MuthukumaranAX Profile Picture
    2,903 on at
    RE: Recalculate credit limit on customer

    this object is available in D365 ideally it should be there in AX 2012 as well.

  • Fredrik Brandt Profile Picture
    15 on at
    RE: Recalculate credit limit on customer

    Hi and thanks,

    I had to rewrite the code a bit, but I created a batch-job from my import.

    Regards,

    /Fredrik.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 865 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 582 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans