This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Products with a Limited Request Period

Hi,

I am struggling with requesting items that have the validity period in ITShop set to a value.

In my scenario the Validity period is set to 365 days. When a user requests an item without specifying "Valid until" as additional information in the shopping cart, the request is sent to the approver with "unlimited" set as valid until value.

If the approver chooses to approve the request, but dont fill in the valid until field, he presented with an error message stating that "Valid until is a compulsory field and needs to be filled". If the approver denies the request, he is unable to change the valid until field and is presented with the same error message.

Is it possible to automatically fill the "Valid until"-value in the webshop with the validity period from the ITShop item?

I'm using D1IM 6.1.2

Any help will be greatly appreciated!

  • So is the scenario that if no Validity period is supplied by the requestor, then 365 should be used, or is it always 365 days for that particular product? Or is the 365 period once the request has been approved?

    Eitherways, you shoud be able to do this by putting a template on the ValidUntil column on ShoppingCartItem, something like (complete untested!!)

    If $FK(UID_AccProduct).Ident_AccProduct.Equals("My Product) Then

    Value = DateTime.Now.AddYears(1)

    End If

    Alternatively, if the Validity period is for 1 year AFTER approval, then you can put the template on the ValudUnti on PersonWantsOrg and calculate it to be 1 year after DateAssigned.

    HTH

    Aarav

  • Thank you!

    The exact scenario is that the ValidTo date should be calculated based on the MaxValidDays from the product requested. This is the tempate i used on the ValidUntil column on ShoppingCartItem:

    If DbVal.IsEmpty(Value, ValType.Date) AndAlso Not DbVal.IsEmpty($FK(UID_ITShopOrg).FK(UID_AccProduct).MaxValidDays$, ValType.String) Then
        Value = DateAdd(DateInterval.Day, Val($FK(UID_ITShopOrg).FK(UID_AccProduct).MaxValidDays$), Today) + New TimeSpan(23,59,59)
    End If

  • I was celebrating a bit too early.

    After the final approver have approved the request, the ValidUntil date is reset to the date of approval plus the value of MaxValidDays from the product requested, no matter what I set as ValidUntil in the shopping cart, or later in the approval process.

    Example:

    I set MaxValidDays on the service item to 365
    When the user orders an item, the ValidUntil is automaticcally set to 13.09.2017,
    The user changes the date to 20.09.2016
    The approver gets the new date and approves the request with ValidUntil set to 20.09.2016
    The date is reset to 13.09.2017 when the request is approved. The date should have been 20.09.2016


    This happens even with the custom template in ShoppingCartItem is removed.

  • You'll have to customize the template at PersonWantsOrg.ValidUntil as well. There is an OOTB template that recalculates the value using the MaxValidDays from the service item.

  • Hi Markus,

    The default template at PersonWantsOrg.ValidUntil is set to the following. It shouldn't do more than adding the TimeSpan to the date:

    ' With $ValidUntil$ we usually mean the end of this day
    If Not DbVal.IsEmpty(Value, ValType.Date) AndAlso CDate(Value).TimeOfDay = TimeSpan.Zero Then
        Value = CDate(Value) + New TimeSpan(23,59,59)
    End If

  • Sorry. I checked the template in version 7. I missed that you are using 6.12.

    This is a customizer function in 6.1.2 and therefor cannot be overwritten easily.

  • What does customizer function imply? Is there a more complex way to solve this in 6.1.2?

  • I would suggest, that you are trying to contact the support and describe them your issue.

    The behavior has changed slightly in 6.1.3 so that the MaxValidDays will only be set if (ValidUntil - OrderDate - MaxValidDays) < 24h.

    If you contact support, please mention VPR#19233 to see if there is a HotFix for 6.1.2 available.