Is there any way to capture a form layout through script or any other way?

Abhijit4
Mega Sage

Hi All,

I have requirement to capture lot of form layout with its all sections (Including all section it is almost 400), now I need to do this manually, but Is there any way I can do this with script or any other efficient way?  

 

Thanks

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

Hi All,

 

I have implemented this with script. Basically when we change form layout, system captures form section (sys_ui_section table) with all it's associate element (sys_ui_element). I did the similar thing with script.

I wanted to do this for three views then I did with below script,

 

var viewSysIDs=['2e319f86db706b406622f97e0f96198c','baa70bcbdbb8eb406622f97e0f961962','df704387dbb8eb406622f97e0f9619db'];

for(i=0;i<viewSysIDs.length;i++)
{
var grSection=new GlideRecord('sys_ui_section');
grSection.addQuery('view',viewSysIDs[i]);
grSection.query();

while(grSection.next())
{
var umSection= new GlideUpdateManager2();
umSection.saveRecord(grSection);

var grElement=new GlideRecord('sys_ui_element');
grElement.addQuery('sys_ui_section',grSection.sys_id);
grElement.query();

while(grElement.next())
{
var umElement = new GlideUpdateManager2();
umElement.saveRecord(grElement);
}
}
}

 

Hope this will help someone in future.

 

Thanks everyone for your help.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

4 REPLIES 4

Sanjay Bagri1
Tera Guru

Hi 

You want to capture the form layout and that form layout you want to move from one instance to another instance. if it is correct .

So please create a update set and disign your form according to your requirements and complete that update set and move it to other instance Click here for more details about update set.

Please mark as correct and helpful if my suggestion helped you.

Thanks 

Sanjay Bagri

Thanks Sanjay for reply.

 

I want to know other ways than manually doing this because I have more than 400 sections to capture.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Priyanka136
Mega Guru

Hey Cody,

Please refer the below link which might help to solve your query: - 

https://community.servicenow.com/community?id=community_question&sys_id=3f3f7a69db58dbc01dcaf3231f96...

Thanks,

Priyanka

Abhijit4
Mega Sage

Hi All,

 

I have implemented this with script. Basically when we change form layout, system captures form section (sys_ui_section table) with all it's associate element (sys_ui_element). I did the similar thing with script.

I wanted to do this for three views then I did with below script,

 

var viewSysIDs=['2e319f86db706b406622f97e0f96198c','baa70bcbdbb8eb406622f97e0f961962','df704387dbb8eb406622f97e0f9619db'];

for(i=0;i<viewSysIDs.length;i++)
{
var grSection=new GlideRecord('sys_ui_section');
grSection.addQuery('view',viewSysIDs[i]);
grSection.query();

while(grSection.next())
{
var umSection= new GlideUpdateManager2();
umSection.saveRecord(grSection);

var grElement=new GlideRecord('sys_ui_element');
grElement.addQuery('sys_ui_section',grSection.sys_id);
grElement.query();

while(grElement.next())
{
var umElement = new GlideUpdateManager2();
umElement.saveRecord(grElement);
}
}
}

 

Hope this will help someone in future.

 

Thanks everyone for your help.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP