Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

_ubho
Kilo Contributor

Hi All,

 

Today I encountered a severe issue in which we had created a table but forgot to extend the task table. As most you are aware that the group approvals can only work on tables extended by task tables. So it was a utmost problem for us and the only solution was to re-create the table. Not only is this a huge amount of work but also its a tedious job. So with the help of google and a little hilly-dilly here and there I found a way to achieve this with a minimalistic effort. This code might help you in this case. All thanks to ServiceNow Elite.

 

Please find the code below:-

 

var table = 'u_test'; // your custom table
var v_OldParent = ''; 
var v_NewParent = 'task'; // the table you want to extend

var changer = new GlideTableParentChange(table);
changer.change(v_OldParent,v_NewParent);

Hope this helps.
Comments
rutuja6
Tera Contributor

Hi @_ubho ,

This code doesn't work in scoped application, do you have any other workaround for this?

 

Thanks,

Rutuja

Yamilla Manjko
Tera Guru

@rutuja6 That's true, you need to execute the script on Global scope, I did it using the background script, changed the scope to Global and unchecked the Record for rollback? option as stated in this post from Maik Skoddow and it worked

Version history
Last update:
‎11-30-2018 01:04 AM
Updated by: