Dynamic URL for Widget in Service Portal

Paolo2
Tera Contributor

I have a variable in our SP with type as Custom with label and associated into a widget. Whenever a user selects a specific service request menu, this widget will be displayed to download the specified application form. See widget code below.

 

Paolo2_0-1685454716545.png

We have hundreds of service request menus and each of them have different application forms and sysID. I want to make the sysID dynamic based on the selected service request menu so I don't need to create multiple widgets and variables. How can I achieve this requirement?

2 REPLIES 2

jaheerhattiwale
Mega Sage
Mega Sage

@Paolo2 Write below function in the client controller of widget used in custom with label variable

 

$scope.$watch(function() {

c.data.serviceRequestId = $scope.page.g_form.getValue("service_request")

});

 

jaheerhattiwale_0-1685457237737.png

 

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Thank you very much! Let me try this.