Data table widget using macro variable

Akki1
Tera Contributor

Hi Priyanka,

i have used the Data table widget using macro variable. i am seeing result like below.

i am getting any table view, Please let me know if missed anything.

 Or can you help me to create some custom widget to display table records and use it in catalog variable

 

1 ACCEPTED SOLUTION

Markus Kraus
Kilo Sage

I think this is related to your "hide submit" button post (please close the thread if you have found a solution)?
https://community.servicenow.com/community?id=community_question&sys_id=aeaf6d5d1b374990c17111751a4bcbc3

I guess in this case you want to go with the custom widget solution. The Widget is down below, here is an example of how this will look like:
find_real_file.png

Name: My Incidents
Body HTML Template:

<div>
  <sp-widget widget="data.widget" />
</div>

 Server script: 

(function() {
	data.widget = $sp.getWidget('widget-data-table', {
		table: 'incident',
		filter: 'assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe' // <Assigned to> <is dynamic> <Me> 
	});
})();

If you want a different filter, simply go to incident.list use the filter and then right click on the breadcrumbs: "Copy query" and paste this query in the server script.

Please let us know if this solved your problem 🙂

View solution in original post

18 REPLIES 18

the "sys_id" used in the client script is ".v" + <widget-form sys_id>, so if you use a different widget in the spModal.open, you have to use the sys_id of this widget instead.

works 100%, please check again if you configured the client script properly:
find_real_file.png

heres the proof of this method working:

find_real_file.png

Thanks @Markus Kraus  A lot !!!

What instead of all this I just want when the user clicks the Record it should open in new tab in native ui ? how can i do this?

thanks a lot for the efforts.....

$scope.$on('data_table.click', function (event, params) {
    $window.open('nav_to.do?uri=%2F' + params.table + '.do%3Fsys_id%3D' + params.sys_id, "_blank");
});

Hope this answers all your questions 🙂

Please mark the solving answer as the solution to close the thread if you got no more questions.

hi @Markus Kraus 

I have members table which has users in it and I want to display groups which I am the member of . But If i do directly it will show the members table (i.e group names only and user ) but instead I want to show the group table for it .Below are the table structure attached pls have a look. Groups Name in Members table is a reference type referencing to u_grp_table.

Members Table(u_grp_members)

  Groups Name

      User

  Y_test_grp

 Allen Thomas

 Z_test_grp

Allen Thomas

 K_test_grp

Allen Thomas

 

Groups Table(u_grp_table)

 Groups Name

  Group Description

  Group Template

  Y_test_grp

 Check y grp

Simple

 Z_test_grp

Check z grp

Columns

 K_test_grp

Check k grp

double

 A-test_grp

Check a grp

simple

 B_test_grp

Check b grp

simple

Hi @Markus Kraus 

Hi ,

I have used data table in my custom created widget but the alignment is not proper displaying the data.In the first line there is some extra space coming.

 eg: if you see group decription 'c' starts one space as compared to the second line the word 'n'.Ideally C and O should be in the same alignment

                     Groups Name

    Group Description

   Group Template

  Y_test_grp

One space

    Check y grp

 One space extra frm 1st line

 ------------------extra space here also

Simple

 Z_test_grp

  Check z grp

One space extra

Columns

 K_test_grp

  Check k grp

One space extra

 

double

 A-test_grp

  Check a grp

One space extra

simple

 B_test_grp

  Check b grp

One space extra

simple

I haven't used anything in html I have just fetched the widget

 

image