End_date should not be less than Start_date (Date/time variables)

Southsayer
Tera Expert

Hi Guys,

I have two date/time variables with names campaign_start_date and campaign_end_date on the catalog item view.

I need to check if the campaign_end_date is less than campaign_start_date, I need to clear campaign_end_date value and show a field message. 

 

is there a way to do that using the Catalog UI policy? if yes, please help me out using the catalog UI Policy because it is my first preference. 

if not, could you please provide me with the catalog client script code?

 

thanks in advance

1 ACCEPTED SOLUTION

I am using Catalog UI Policy.

 

Condition: compaign_start_date  is more than  0  Hours  after  compaign_end_date

MuhammadKhan_0-1666881793928.png

MuhammadKhan_1-1666881823368.png

 

Script: g_form.clearValue('compaign_end_date');

g_form.showFieldMsg('compaign_end_date', 'End Date must be at or after start date.', 'error', true);

MuhammadKhan_2-1666881856223.png

 

View solution in original post

6 REPLIES 6

Muhammad Khan
Mega Sage
Mega Sage

Try like below images.

MuhammadKhan_0-1666873329479.png

MuhammadKhan_1-1666873408920.png

 

Refer to below article for better understanding.

No Code date validations through (Catalog) UI Policies 

HI, nothing is happening using this.

could you help?

Well, it is working for me. May be, you can share what you have tried or go through the above article.

Actually, I am working on the catalog UI policy, did you try it there?

I have added campaign_end_date is more than 0 hours after campaign_start_date (it's wrongly written in the picture) and also I tried with campaign_start_date is more than 0 hours after campaign_end_date

WhatsApp Image 2022-10-27 at 6.56.09 PM (1).jpegWhatsApp Image 2022-10-27 at 6.56.09 PM.jpeg