Update the field with sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-12-2022 04:57 AM
Hello Experts,
I need to populate a field with the value from another field.
Ex : in description i used to have a value like
"{'sys_id':'00128698db83d4100a577fa4f3961911','hostname':'test1.com'} "
When the record is getting inserted, then the sys_id value from the above value should insert to another field.
I have written the below code to get the value inserted but still the value comes as empty :
Script 1 :
(function calculatedFieldValue(current) {
var obj = current.description;
gs.info("ID" + obj.sys_id);
if (obj.sys_id) {
return obj.sys_id;
}
} // Its not working
Script 2 :
// var str = current.description;
// var answer = JSON.stringify(str.sys_id);
// gs.info(answer);
// return answer;
Can you please help me with code as earliest.
Thanks in advance.
Looping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-12-2022 05:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-12-2022 05:16 AM
Hi Chaithu,
Also the object you provided in the string is invalid due to the single quotes, this will cause errors in the script
It should be something like this