Erase a field value when a read only date field changes.

1_DipikaD
Kilo Sage

Hi All,

 

I want to erase existing values from a field when a date field changes but  the date field is ready only in form view . What should be the correct approach to do this . 

 

Please advise.

 

Thank You

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@1_DipikaD 

you can use before update business rule and clear the value

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sorry, forgot to mention that field should be erased after the date changes . So if I follow business rule , could you please let me know what should be the script be like ? And is there any possibility to achieve this via any other  method ?

@1_DipikaD 

so user changes date field and other field needs to be cleared?

I didn't get your question, if date field is readonly on form then how the user is changing?

Is it getting changed from backend logic i.e. server side? if yes then in same script add logic to clear the other fields

if not then why not write onChange client script and use g_form.clearValue()

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@1_DipikaD 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader