Planned Start date on Change request form to be in the past

Rooma1
Tera Contributor

Hi All,

I have requirement to allow the past dates to be set on the fields -"Planned Implementation Start/End Date". The same is working for the Emergency Change type and the client wants the same functionality for the "Latent Change" type.

 

I tried making the changes on the existing client script which is for Emergency Change but it is not working. I tried adding the line - "g_form.getValue("type") != 'latent_change' with the OR condition on the line number 18( Please refer the screenshot).

 

Like this : - if (g_form.getValue('type') != 'emergencychangenew') || (g_form.getValue('type') != 'latent_change')

 

but when i am replacing the type as latent_change in the place of 'emergencychangenew' on line number 18 then it is working for Latent change and not for Emergency change.

 

Can anyone plz tell what is the mistake I am doing. 

1 ACCEPTED SOLUTION

Mark Manders
Tera Patron

I don't know what is going on, but it seems to be raining OR questions lately. Your query will always return true, like any query with 'OR' and two negatives:

 

if type is not 'a' OR type is not 'b':

- if type is 'a': true, because it's not 'b'

- if type is 'b': true, because it's not 'a'

- if type is 'c': true, because it's not 'a' (or 'b')

 

Change it to && instead of  || and if that doesn't solve it, please share your entire script, so we can ensure nothing else is wrong in there.

 

View solution in original post

4 REPLIES 4

Mark Manders
Tera Patron

I don't know what is going on, but it seems to be raining OR questions lately. Your query will always return true, like any query with 'OR' and two negatives:

 

if type is not 'a' OR type is not 'b':

- if type is 'a': true, because it's not 'b'

- if type is 'b': true, because it's not 'a'

- if type is 'c': true, because it's not 'a' (or 'b')

 

Change it to && instead of  || and if that doesn't solve it, please share your entire script, so we can ensure nothing else is wrong in there.

 

@Mark Manders Thanks Mark.. It worked. 

Deborah Brown L
Kilo Sage

Hi @Rooma1 ,

It need a overall bracket after if. Try the below code,

if ((g_form.getValue('type') != 'emergencychangenew') || (g_form.getValue('type') != 'latent_change'))

Thanks

Please mark answer correct/helpful based on impact 

 

@Deborah Brown L I had already tried this but it didn't work.