[Service Portal] Undefined widget options

macmat1
Tera Contributor

Hello,

 

I am doing a very very simple code based on the widget [My Requests]. I embedded this widget inside another one :
Parent widget : item.widget = $sp.getWidget('widget_name', widgetfilter);

Then in the children widget I a ma calling the option to use it inside a glide record :
Children widget (embedded one) :  data.short_description = options.short_description;

var ids = {};
data.tableName = [];
var i = 0;
var rq_filter = new GlideRecord('request_filter');
rq_filter.addQuery('short_description', data.short_description );
rq_filter.addActiveQuery();
if (rq_filter.isValidField('applies_to'))
rq_filter.addQuery('applies_to', 1).addOrCondition('applies_to', 10);
rq_filter.query();

At the first load it works perfectly fine, however if I call the OOTB client function : 
c.loadMore = function() {
window.GlideWebAnalytics.trackEvent("Service Catalog", "Catalog My Requests", "Show More Clicked");
var currentRequests = c.data.request.req_list.length;
spAriaUtil.sendLiveMessage("${Loading more requests}");
c.fetching = true;
c.server.get({
action: 'fetch_more',
lastLimit: c.data.lastLimit,
view: c.viewFilter,
search_text: c.filterText
}).then(function(response){
var addedRequests = response.data.request.req_list.length - currentRequests;
var resultMsg = (addedRequests == 1 ? 'request' : 'requests') + ' added';
spAriaUtil.sendLiveMessage(i18n.getMessage('{0} ' + resultMsg).withValues([addedRequests]));
c.data = response.data;
c.fetching = false;
});
}
It set the "options.short_description" to "undifined". which is a nonsense. 

If I "hardcode" a string like data.short_description = "my_short_description"; it perfectly works.

Can someone explain me why ?

Thank you and have a nice day

1 REPLY 1

-O-
Kilo Patron
Kilo Patron

Can you share how variable widgetfilter looks like?