- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 09:03 PM
Hi Community , Can we auto create table with the help of script or anything ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 10:09 PM
Hello @t7
HTML Code :-
<div class="panel panel-default">
<div class="panel-heading">Templates</div>
<div class="panel-body">
<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction()">Create Table</button>
</div>
</div>
Client Script :-
function() {
var c = this;
c.uiAction = function(action) {
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
})
}
}
Server Script :-
(function() {
var table_name = 'abc', extends_table = 'task', fname = 'myfield';
var attrs = new Packages.java.util.HashMap();
var ca = new GlideColumnAttributes(fname);
ca.setType("string");
ca.setUsePrefix(false);
attrs.put(fname, ca);
var tc = new GlideTableCreator(table_name , table_name);
tc.setColumnAttributes(attrs);
if(typeof extends_table != 'undefined') tc.setExtends(extends_table);
tc.update();
})();
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 09:13 PM
Hello @t7 ,
refer this thread Can we create table using script?
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 09:18 PM
thanks for your help @Chetan Mahajan . Can we create a table with the help of widget? Like after clicking on widget in any portal a table should be created in backend , can we achieve it anyhow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 10:09 PM
Hello @t7
HTML Code :-
<div class="panel panel-default">
<div class="panel-heading">Templates</div>
<div class="panel-body">
<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction()">Create Table</button>
</div>
</div>
Client Script :-
function() {
var c = this;
c.uiAction = function(action) {
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
})
}
}
Server Script :-
(function() {
var table_name = 'abc', extends_table = 'task', fname = 'myfield';
var attrs = new Packages.java.util.HashMap();
var ca = new GlideColumnAttributes(fname);
ca.setType("string");
ca.setUsePrefix(false);
attrs.put(fname, ca);
var tc = new GlideTableCreator(table_name , table_name);
tc.setColumnAttributes(attrs);
if(typeof extends_table != 'undefined') tc.setExtends(extends_table);
tc.update();
})();
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2023 10:49 PM
Thank you so much @Samaksh Wani