How to hide fields on create new form ?

Kruthik M Shiva
Tera Contributor

Hi All,
I have a requirement where I need to hide couple of fields to hidden in the create new form. then once the record is created, I want those two fields need to be visible how to do this please provide any pointers on this. Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Kruthik M Shiva 

you can use onLoad client script on that table and check if it's new record or not

function onLoad(){
	if(g_form.isNewRecord()){
		// hide your fields since it's new record
	}
}

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Kruthik M Shiva 

you can use onLoad client script on that table and check if it's new record or not

function onLoad(){
	if(g_form.isNewRecord()){
		// hide your fields since it's new record
	}
}

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

kotharir
Tera Expert

@Kruthik M Shiva Write onload client script as below. I have written on incident table. please change the table based on requirement.client script.PNG

function onLoad() {
    if (g_form.isNewRecord()) {
        g_form.setVisible('description'false);
    }

}
Please mark the answer correct if helps.