delete and update the data based on the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 01:53 AM
Hai All,
my question is , i have created a custom table on that i have created a field to attach an file to load the data in to the child table . still there i was working fine ,
on the custom table i have created a field true or false , when i select true the child table data should be deleted and again it should be loaded as well as for false also.
I want to delete the data and reload the data again how can we do it. please guide me on this over to fix it ,
thank you ,
Sekhar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 03:08 AM - edited 12-16-2022 03:09 AM
Hi @sekhar6 ,
1. You can create after/async BR on the change of true/false field.
2. If it's true, GlideRecord() child table and delete record by gr.deleteRecord()
3. If false, check Deleted Records[sys_audit_delete] table and retrieve data back. (See the 'Undelete Record' UI Action script)
Note: Deleted Records table stories record only for 7 days and not all types of data/records are stored.
4. If you can't achieve what you want from the above step then create one custom table to temporary store deleted records.
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 03:31 AM
hai
if the field on the Custom Table is is true , two fields data data should be hidden and if its false the data should be populated when its saved.
i have written async business rule it was also fine but, when its true only it was working when have chaged again the field to false it was not populating the data .
when i click yes data should be hide , when it is No the data should be visible on the child table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 03:36 AM
Hi @sekhar6 ,
Data means field visibility?
What condition have you added in BR?
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2022 03:49 AM
data means what we have loaded to attachment
i will share my script what i have written
var items = new GlideRecord('u_item_changes_volume');
items.addQuery('u_event',current.sys_id);
items.addNotNullQuery('u_current_store_count');
items.addNotNullQuery('u_future_store_count');
//items.addNotNullQuery('u_annual_units_replenishment');
items.query();
while(items.next()){
items.u_current_store_count = '';
items.u_future_store_count = '';
//items.u_annual_units_replenishment = '';
items.update();
}
when ecommers is true the data becomes null if ecommers is false the data should be as loaded