Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Customer Credit Limit Has Been Exceeded

Posted on by 585

Hi,

I am trying to create sales orders for a customer. I receive an error that the customer credit limit has been reached. 

I am using the API to create transactions. When creating a customer, how do I tell GP that the customer has an unlimited credit? Here is my code:

static void CreateCustomer()
{
CompanyKey companyKey;
Context context;
Customer customer;
CustomerKey customerKey;
Policy customerPolicy;

// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();

// Be sure that default credentials are being used
wsDynamicsGP.UseDefaultCredentials = true;

// Create a context with which to call the service
context = new Context();

// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);

// Set up the context
context.OrganizationKey = (OrganizationKey)companyKey;

// Create a new customer object
customer = new Customer();

// Create a customer key
customerKey = new CustomerKey();
customerKey.Id = "ADMINISTRATORGL";
customer.Key = customerKey;

//assign unlimited class

CustomerCreditLimit cc = new CustomerCreditLimit();
cc.Item = //what do I put into item?
cc.Period = 10;
cc.PeriodAmount = new MoneyAmount { Currency = "USD", DecimalDigits = 4, Value = 20000 };

customer.ClassKey = new CustomerClassKey { Id = "USA-ILMO-T1" };
// Set properties for the new customer
customer.Name = "Global Admin";
// Get the create policy for the customer
customerPolicy = wsDynamicsGP.GetPolicyByOperation("CreateCustomer", context);

// Create the customer
wsDynamicsGP.CreateCustomer(customer, context, customerPolicy);

}

*This post is locked for comments

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans