Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Update pricing data Job

Vote:
 

Hi,

I am trying to create a scheduled job that updates pricing infomation. When I run the job I can add new data using IPriceDetailService.Save(see below), but I am not sure how to update existing pricing data.

public IPriceDetailValue SavePriceDetailValue(Entry catalogEntry)

{
    var priceDetailService = ServiceLocator.Current.GetInstance();
 
    // Set Price Detail value for Catalog Entry.
    var priceDetailValue = new PriceDetailValue
    {
        CatalogKey = new CatalogKey(catalogEntry),
        MarketId = new MarketId("US"),
        CustomerPricing = CustomerPricing.AllCustomers,
        ValidFrom = DateTime.UtcNow.AddDays(-7),
        ValidUntil = DateTime.UtcNow.AddDays(7),
        MinQuantity = 0m,
        UnitPrice = new Money(100m, Currency.USD)
    };
 
    return priceDetailService.Save(priceDetailValue);
}



Thank you in advance

#145319
Mar 01, 2016 22:54
Vote:
 

Not possible to just use the List method to get the existing and then update them and then call save with the updated values as parameter?

...or am I missing something? :)

#145322
Edited, Mar 01, 2016 23:57
Vote:
 

is possible to provide sample code of what you are refereing too? I am new to this.

Thank you in advance

#145323
Mar 02, 2016 0:42
* 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.