The Zurich release has arrived! Interested in new features and functionalities? Click here for more

On form two dates field , if date1 is not equal to date2 the string field should populate.

vipuljay
Tera Contributor

Hi All,

On form two dates field , if data1 is not equal to date2 the string field should populate.

 

 

 

Thanks in Advance.

3 REPLIES 3

Community Alums
Not applicable

Hi @vipuljay ,

You can create onLoad client script and it will check both two dates you can refer below script 

var dateOne = g_form.getValue('date_one') // backend name of date_one
var dateTwo= g_form.getValue('date_two') // backend name of date_two

if(dateOne == dateTwo){
         Add code here as per requirment
}

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Hi @Community Alums, 

Thanks for the quick response,

 

I tried your code but i was not able to populate a string field, can you please help with it.

Community Alums
Not applicable

Hi @vipuljay ,

I tried your problem in my PDI it works for me 

I created onLoad client script and added below code 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var start = g_form.getValue('start_date');
   var endDate = g_form.getValue('end_date');
   alert('start = ' + start);
   alert('endDate = ' + endDate);
   if(start == endDate){
	alert('both Same');
   }else{
	alert('No Same');
   }
}

SarthakKashyap_1-1714496724245.png

 

Result 

SarthakKashyap_0-1714496679322.png

Note: GlideDateTime api is not work here in client script if you want to work with GlideDateTime we need to do a AJAX call. Please let me know if you want that code.

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak