Organization on OrderGroup


Hi all,

We are currently building a commerce website and are using the Serializable Cart. I am trying to register the Id of the organization of a contact on the cart. I found a property on the cart "Organization", type nullable Guid. Looks great...

However after saving the ICart as PurchaseOrder: orderRepository.SaveAsPurchaseOrder(cart), the organizationId is nowhere to be found on the PurchaseOrder.
After some decompiling I found out that the SaveAsPurchaseOrder copies the Organization property from the cart to the purchase order.
Which eventually results in calling the setter on the Mediachase.Commerce.Orders.OrderGroup class. This property contains the following code:

Guid? IOrderGroup.Organization
        if (string.IsNullOrEmpty(this.OwnerOrg))
          return new Guid?();
        Guid result;
        return Guid.TryParse(this.OwnerOrg, out result) ? new Guid?(result) : new Guid?();
        if (value.HasValue)
          this.OwnerOrg = value.ToString();
        this.OwnerOrg = (string) null;

I do not get the last line: setting the property to null again ...

Any ideas why, or how to store the current contact organizationId on the cart and propagating it to the PurchaseOrder?

Jun 25, 2020 10:07

I think that is a bug it should return after setting the value if the if statement.  You can try setting the PurchaseOrder.OwnerOrg field directly after converting.

Jun 29, 2020 20:39
* 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.