How to set portal parameters for the widget editor

ytrottier
Tera Contributor

I am building a widget in the widget editor that depends on a portal parameter.

Since I am developping in the widget editor, that portal parameter does not exist, and the preview is either empty, or worse, fails with an ugly error.

Obviously, hard coding the portal parameter in the server script fixes everything.

So, the question is:

Is there a place where we can set default portal parameters that will allow the widget editor to not break because it is running on its own, out of the portal context ?

I know we can easily define instance options, but I did not find a place to manage portal parameters.

Thanks.

2 REPLIES 2

ytrottier
Tera Contributor

And 2nd question :


Given the syntax of $sp.getParameter('parameterName') we can use in the server script to get the value of a portal parameter, is there an equivalent syntax we can use in the client script and the HTML template to directly access the portal parameters, without having to assign a data variable through the $sp.getParameter method in the server script ?


Thanks.


You can do something like below. In this way, if it doesn't find any value, it will take the last value 'sys_id!=NULL' as the default value.



data.filter = input.filter || options.filter || 'sys_id!=NULL';



You will have to assign the value to the data variable to access it in HTML or Client Controller. In Client Controller you can access that variable in $scope.data.variablename.



Please mark this response as correct or helpful if it assisted you with your question.