
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 09:14 AM
I'm trying to create a widget which displays a users information. I'm calling both the User Table and my custom 'members table' which references many of the fields within the user table. When a user clicks the delete button I want the record from the members table to be deleted and when the update button is pressed I want the User table to be updated. This isn't my issue though. My issue is that when I use the server.update() method it updates and then deletes the record no matter which button is pressed. I understand why it's not working but not how to fix it. How can I separate the calls to the server?
Here's my client and server side code:
$scope.deleteUser = function() {
$scope.server.update();
}
$scope.updateUser = function() {
$scope.server.update();
}
================================
if(this.input) {
memberRecord.deleteRecord();
}
if(this.input) {
userRecord.first_name = this.input.user.firstName.toString();
userRecord.last_name = this.input.user.lastName.toString();
userRecord.email = this.input.user.email.toString();
userRecord.roles = this.input.user.roles.toString();
userRecord.update();
data.user = this.input.user;
gs.addInfoMessage('Update Successful');
}
Thanks,
Dylan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 09:28 AM
One way to do this would be to add an action variable into your input object.
Set $scope.data.action to update or delete when the respective button is pressed, then on the server say if(input.action =="delete")... and so on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 12:08 PM
Hey Jesse do you have a full example of updating with a button.
The html, server, and client side sample code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 11:43 AM
Hi Dylan,
You are very close to making these connections that you are attempting. One thing about Angular is that you can pass the whole data object in your function. What I mean by that is if you are using an ng-click function you can reference it like this:
<div ng-click="deleteUser( user )" >{{user.first_name}}
</div>
</div>
on your client controller you can reference that
function deleteUser( user ) {
user.action = delete
c.server.update()
}
I hope this helps and if you have any more questions let me know and I will be glad to help.
Philip Engles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 07:05 AM
Hello Phillip what if I want to update information in a record could I use the same code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 06:51 AM
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2018 04:16 AM
Hi All,
I have one issue with service portal widget. I have created one custom widget to cancel RITM and add cancel comments. functionality is working fine but comments are adding multiple times. can anyone suggest me on this.
Thanks