want to update sys id value into the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 09:34 AM
In the below screenshot , i want to update the sys id of category field value into unique field , can anyone help me how to update all data using background script.
#script #background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 10:04 AM - edited 02-12-2024 10:27 AM
Hi,
You can use business rule (or) client script to populate to pass Category sys_id to the Business Unit.
background script:
var gr = new Gliderecord('your table name');
gr.addQuery('your query here');// use category is not empty
gr.query();
while(gr.next()){
gr.business_unit= gr.category.sys_id;
gr.setWorkflow(false);
gr.update();
}
(or)
Client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var incSD = g_form.getReference('your category field name', populate);
function populate(incSD) {
g_form.setValue(your business unit fied name', incSD.sys_id);
}
Please mark it as helpful (or) correct if it helps.
Thanks & Regards,
Sumanth meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 10:19 AM
Hi @siva14 ,
Can you share more technical details on this, the attached image has Category field editable, so you can update this on form. Is this category field is reference type and pointing to table ( which table ) or its select box pointing to Choice [ sys_choice ] or some form specific select box where values are stored in Question Choice [ question_choice ] table.
If there are more record and you want to update via backgroud code then write Fix Script.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution