Widget save fails with message: "Could not save record because of a compile error"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 12:33 AM
Hi,
I try to add a "Delete" button on the widget "Form". Below you can see the HTML and client-side part.
However, when I try to save, I see the following message:
HTML part:
<button ng-if="getPrimaryAction()" type="submit" ng-click="c.delete()" ng-disabled="submitting" class="btn btn-primary action-btn pull-right">${Delete}</button>
Client-side:
var c=this;
c.delete = function() {
c.data.action = 'delete';
c.server.update();
var hosturl = 'https://' + $window.location.host;
$window.location.href = hosturl + "/sp?id=sc_home";
};
Any ideas why I can't save it?
Smith.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 11:34 AM
Hello @Smith Johnson
var c=this;
$scope.c.delete = function() {
c.data.action = 'delete';
c.server.update();
var hosturl = 'https://' + $window.location.host;
$window.location.href = hosturl + "/sp?id=sc_home";
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2023 01:48 AM
thanks it worked 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2023 08:49 AM
I thought that it worked, but it seems there is an issue.
The code is as shown below. Do you see any issue there?
$scope.c.delete = function() {
spModal.open({
title: 'Delete record',
message: "Are you sure that you want to delete the record?",
buttons: [
{label:'✘ ${NO}', cancel: true},
{label:'✔ ${YES}', primary: true}
]
}).then(function() {
c.agree = 'yes';
c.data.action = 'delete';
c.server.update().then(function(response) {
setTimeout(function(){
var hosturl = "https://" +$window.location.host;
$window.location.href = hosturl + "/sp?id=sc_home";
}, 2000);
});
}, function() {
c.agree = 'no';
})
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2023 09:05 AM
Did you accepted my solution of previous response @Smith Johnson