- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 01:35 AM
Hi All,
I am new to the service portal, just started practical learning on it, I am creating a simple custom widget with simple client script as below, getting an error as highlighted in the red color,
Can someone provide me the useful URL/Documents or Youtube videos for a custom widget creation?
// Client script
function(spModal) {
var c = this;
c.onAlert = function () {
spModal.alert('How do you feel today?').then(function (answer) {
c.simple = answer;
});
}
}
It should contain a JavaScript function
Screenshot for reference
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 09:59 PM
Hello,
Please check the below ss of what i tried on my PDI -
HTML -
<div>
<button id="widget-button" class="btn btn-primary" ng-click="c.onclickFunc()">Submit</button>
</div>
Client Controller -
function(spModal){
var c = this;
c.onclickFunc = function()
{
spModal.alert("Hi");
}
}
What i think here is you're editing the widget in the backend and not in the widget editor, try this in widget in editor and you wont see the error.
I have the same error in the PDI and hence it is asked to edit a widget in Widget editor always.
Hope this resolves your issue.
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 01:44 AM
You have commented the OOB function , can you try to write your code within the OOB function
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 01:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 01:46 AM
Hi,
Check below links to create custom widget.
https://www.youtube.com/watch?v=08oU930rK50
https://www.youtube.com/watch?v=s9vX4lTz06Q
Mark correct/helpful based on impact.
Thanks,
Dhananjay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 04:18 AM
Hi,
Are you able to solve your issue by looking above links? If yes then mark this as correct so question will remove from unanswered thread and others will refer same in future.
Thanks,
Dhananjay.