November Happy Hour will be moved to Thursday December 5th.

Change customer on a purchase order

Vote:
 

Hi!

Is there anyway to change the customer on a purchase order? I can't find any support for this in the Manager, can it be done by code instead?

Thanks!

/Kristoffer

#150499
Jun 21, 2016 7:42
Vote:
 

Hi,

I haven't tested changing this after the order has been created, but PurchaseOrder has a property CustomerId you can set. You need to check how this affect existing order data such as shipping and billing address.

#150649
Jun 27, 2016 10:56
Vote:
 

Hi,

Why would you want to change the customer and which values do you want to change?

/Q

#150656
Jun 27, 2016 11:28
Vote:
 

Hi!

Thanks for your replies.

A customer can buy without being logged in. If that happens we would like to connect the purchase order to the correct user and organization and remove the temporarily created on. Is that possible?

/Kristoffer

#150657
Jun 27, 2016 11:34
Vote:
 

Hi,

In that case it's entirely possible. In facts, when a customer places orders as anonymous, then logs in, the ProfileModule will automatically update the last orders to the contact.

So I think this can be done:

order.CustomerId = customerContact.PrimaryKeyId ?? Guid.Empty;
order.CustomerName = customerContact.FullName;
order.AcceptChanges();


#150665
Jun 27, 2016 12:12
Vote:
 

I can confirm that that is possible, yes. You could typically have a registration form on your order receipt page and then connect the newly created order as part of the registration process. 

#150666
Jun 27, 2016 12:15
Vote:
 

Of course! The CustomerId is a Contact and not an Organization so just by moving the created contact to the correct organization the connection will be correct. If the customer already has an account we can use Quans code above to "move" the purcahse order.

Thanks!

#150667
Jun 27, 2016 12:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.