The CreatorCon Call for Content is officially open! Get started here.

Dynamically Populate Widget with Related Records

jakegartenberg
Tera Expert

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.

 

 

jakegartenberg_0-1669041049429.png

jakegartenberg_1-1669043593003.png

jakegartenberg_2-1669043633663.png

jakegartenberg_3-1669043796274.png

 

3 REPLIES 3

jakegartenberg
Tera Expert

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?

Mohith Devatte
Tera Sage
Tera Sage

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

 

 

this does not work, the variables in the server script still appear as undefined