Quantcast
Channel: Microsoft Dynamics GP
Viewing all articles
Browse latest Browse all 59474

Forum Post: Customer Credit Limit Has Been Exceeded

$
0
0

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);

}


Viewing all articles
Browse latest Browse all 59474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>