Service Portal :: Data Table From Instance Definition and widget-form

ggg
Giga Guru

I have Data Table From Instance Definition (table = incident) and widget-form on a page.

the incident displays in the form widget.

I would like the Data Table From Instance Definition to display in a different widget on the page.

How do I tell Data Table From Instance Definition to display in that other widget?

 

1 ACCEPTED SOLUTION

Hi,

If the form has the fields, then you don't nee dto add any code. The widget will take care of the update. I already checked this.

How did you add a field to the form? You need to add a field to the Service portal view as that is the view that gets rendered in the from widget.

And any changes to any of the fields that are displayed in the form will be updated by the widget itself. The code that i give is to update any other fields that are not on the form.

Mark the comment as a correct answer and also helpful if this helps.

View solution in original post

19 REPLIES 19

Data Table from Instance Definition

widget-form

 

Okay, here is how i have done it.

1. Created a new page test_page.


2. Then go to designer and drag the following widgets on this page


data table from instance definition
widget-form (cloned widget)

3. In the data table from instance definition, i edited and gave table as incidents, added some fields. AT the bottom of this form, you will see a field Link to.

4. I selected the same page test_page for link to, so that when clicked on incident, it comes to the same page and the widget can show data based on the sys_id.

Hence you dont' see any data in the widget when first time its loaded as there is no sys_id. 

5. Now go to your test_page http://your-instance.com/sp?id=test_page. you will see a list of incidents and on click of any incident, it shows the incident in the widget below the list.

Now regarding update, this is done at the client side. In client controller, inside function loadForm, you will see a line with the update() which is being executed on save and the data is being updated. 

So if you want to update the table with any other data, then you can do that in your server script under this line

if (input) {
gs.log("Code enters into this block on click of save","Asif");
var gr = new GlideRecord("incident");
gr.get(input.sys_id);
gr.description = "Adding description";
gr.update();
data.table = input.table;
data.sys_id = input.sys_id;
data.view = input.view;
var result = {};

Mark the comment as a correct answer and also helpful if this helps.

does not work

if i add that code under if (input)

the record will update with the data i enter in the script

but

will NOT update the data entered on the form.

for example,

i have a field, u_custom_field.

i set u_custom_field to 'xxxxx'

and on my form i enter 'testtesttest' for short_description.

after save

my rec has u_custom_field set to 'xxxxx'

but short description remains unchanged.

have you tried this?

Hi,

If the form has the fields, then you don't nee dto add any code. The widget will take care of the update. I already checked this.

How did you add a field to the form? You need to add a field to the Service portal view as that is the view that gets rendered in the from widget.

And any changes to any of the fields that are displayed in the form will be updated by the widget itself. The code that i give is to update any other fields that are not on the form.

Mark the comment as a correct answer and also helpful if this helps.

yes! that works!

you are a genius!