0

I have a custom benefit that contains a single property for the BizFX user to enter:

public class GetFreeItemAction : ICartLineAction
{
    public IRuleValue<string> SellableItemId { get; set; }
}

Is it possible to validate the value of SellableItemId? I would like the user to enter the ID on the format Entity-SellableItem-1234.

If this is not possible, I wonder if it is possible to reuse the "special" Item Id field that is used in some qualifications, on a custom benefit? An example: The Is Item Pre-orderable qualification contains an Item Id field that validates if the item actually exists in the selected catalog:

enter image description here

I am on Sitecore XC 9.1.

1

We do something similar in our OSS promotion extensions: Nyxie.

It should be enough to just rename the SellableItemId property to TargetItemId. The default promotion plugin contains a GetPromotionBenefitDetailsViewBlock that will automatically add the Catalog and Item Ids input fields to the Benefit, when it encounters a field named TargetItemId.

  • I will try it out - so this is the only way to perform custom validation on rules? – ebug 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.