- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 08:57 AM
Hi Team ,
We using client controller to call the script include
but we are enable to invoke the script include
Please guide me where it went wrong
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:46 AM
@String ,
Can you please try this method:
Client Code:
$scope.myFunc = function(){
c.data.shipto = $scope.page.g_form.getValue('shipto');
c.data.billto = $scope.page.g_form.getValue('billto')
c.server.update();
}
Server Code:
if (input && input.shipto && input.billto) {
//you can call script include here
var scriptInclude = new scriptIncludeName();
scriptInclude.functionName( input.shipto, input.billto);
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:11 AM - edited 03-07-2023 09:13 AM
Hi @String
If you are using it in a widget: Unfortunately GlideAjax is not supported in the Client Controller of a Widget in Service Portal.
See support article: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0691908
However, you can explore the use of c.server.get as explained in: https://community.servicenow.com/community?id=community_question&sys_id=28e38fa5dbd8dbc01dcaf3231f96...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:13 AM
Thanks @Hendrik Odendaa for your quick response
So any other way is there to call script include because we need to trigger an outbound soap using widget (client controller)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:29 AM - edited 03-07-2023 09:29 AM
Yes @String
You can try and see if using c.server.get instead of GlideAjax in your widget's client script. Like brian_corpuz did in (look for the post at 07-10-2017 10:43 GMT):
https://www.servicenow.com/community/developer-forum/glideajax-is-not-working-in-service-portal-widg...
Let me know if this resolved your issue, or if you need more clarification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:46 AM
@String ,
Can you please try this method:
Client Code:
$scope.myFunc = function(){
c.data.shipto = $scope.page.g_form.getValue('shipto');
c.data.billto = $scope.page.g_form.getValue('billto')
c.server.update();
}
Server Code:
if (input && input.shipto && input.billto) {
//you can call script include here
var scriptInclude = new scriptIncludeName();
scriptInclude.functionName( input.shipto, input.billto);
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact!