How to hide form section only on create form

SSA1
Giga Expert

Hi,

I am facing an issue as below.

there's a form. it has two sections .

  • Inofrmation section
  • Closure information

So, I need to hide this closure information section only when record creation.

but when existing record opens closure information section should be there.

Is anyone has an idea how to achieve this.

1 ACCEPTED SOLUTION

Chandu Telu
Tera Guru
Tera Guru

Hi 

Check the below link it give the details

https://community.servicenow.com/community?id=community_question&sys_id=8141dfe9dbdcdbc01dcaf3231f9619d5

 

function onLoad() {

 

 

  if (g_form.isNewRecord()) {

  g_form.setSectionDisplay('SectionName', false);

  }

  else{

g_form.setSectionDisplay('SectionName', true);

  }

}

Please Mark the answer if correct/helpful , if it helps

View solution in original post

5 REPLIES 5

Chandu Telu
Tera Guru
Tera Guru

Hi 

Check the below link it give the details

https://community.servicenow.com/community?id=community_question&sys_id=8141dfe9dbdcdbc01dcaf3231f9619d5

 

function onLoad() {

 

 

  if (g_form.isNewRecord()) {

  g_form.setSectionDisplay('SectionName', false);

  }

  else{

g_form.setSectionDisplay('SectionName', true);

  }

}

Please Mark the answer if correct/helpful , if it helps

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use g_form.isNewRecord() in your onload client script and check if it's new record or not

Show/Hide Form Section by Name

function onLoad(){

	if(g_form.isNewRecord()){
		g_form.setSectionDisplay('name of section', false);
	}

}

Regards
Ankur

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

Hi @Ankur Bawiskar  

I Need Help On, How to Hide the Details based On Variable this Variable Is Choice Variable In Sc_task table For Particular Catalog Item 

Jagadees22

@Jagadees22 

please post a new question and tag me on that and share all the details there along with complete requirement and screenshots

also share what you tried so far and what debugging did you do

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