Dynamically Populate Widget with Related Records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 07:17 AM - edited 11-21-2022 07:18 AM
I have created a widget that displays on the submission of a catalog item, the purpose is to display related records and have the user confirm they would still like to submit. I need to query a table for records at the same u_store for the same u_problem_type, and display any records that the query returns in a list or table.
- how do i pull the values in the highlighted fields to run my query in the server script?
i have pasted snips of my page, the widget currently, my server script, and html below. i am new to developing widgets on the portal, was able to create this popup on the desktop side with jelly scripting but am struggling to populate the html dynamically here, not sure if im even on the right track. any resources or tutorials would be helpful as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 07:22 AM
this is called by an onSubmit catalog client script, do i need to pass the form values in that similar to how im passing c.message?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 07:47 AM
Hello @jakegartenberg ,
So if you want to access the field values on then form you need to do it from the client controller but not through server script .Once you access the field values in client controller you need to pass it to server script
Here is an example for it :
Client controller:
api.controller=function($scope) {
/* widget controller */
var c = this;
var g_form = $scope.page.g_form;
c.data.field1 = g_form.getValue('your_field1_name');
};
Server script :
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
var store = data.field1;
})();
Use store in the glide record now just like you did in your code .
Hope this helps
Mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 11:19 AM
this does not work, the variables in the server script still appear as undefined