- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2016 09:33 AM
Hi All,
I have created 2 tables, say A & B
Table A stores 'project_code;
Table B refers to this project_code & stores other values related to it like project amount & other values.
My requirement is when i delete that project code record from table A, its corresponding entries in table B should get deleted.
I am writing a 'before-delete' BR on table A(after delete does not fetch project code), it doesn't work.
Here is the code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var bill = new GlideRecord("u_project_billing");
gs.log('test'+current.u_project_code);
bill.query();
while (bill.next()) {
if(bill.get('u_project_code',current.u_project_code))
{
//bill.deleteMultiple();
bill.deleteRecord();
gs.log('test done');
}
}
})(current, previous);
Any help on this please.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2016 01:35 PM
I successfully tested this with the following assumptions:
1. This BR runs on table A, while the to-be-deleted records are on B
2. u_project_code is a reference field on Table B - to Table A
var bill = new GlideRecord("u_project_billing");
bill.addQuery('u_project_code', current.sys_id);
bill.deleteMultiple();
I also suggest to add to your Delete UI action an alert about the deletion of related records.
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2016 01:58 AM
It worked perfetcly, Thanks for your help Harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2016 04:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2017 09:16 PM
Hi All,
I think this is the right conversation chain where In can put up one of my questions related to this. I need to create a bbutton/UI action through which I should be able to select multiple records from User table/custom table and populate the records back to the form. The uiser form/custom form will be opened as a dialog window. So as shown below like delete option available, I want to have one more button, "OK". So when users select multiple records and click "OK", the records should be populated back to the catalog form/any other form. Hope question is not confusing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 12:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 01:23 AM
Hi,
It doesn't seem to help for me. Basically its a glide dialog window . Users should be able to select multiple items and the selected records should be populated back to the original form upon clicking on something.
Regards
Ganapati