populate one field value in same table another field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 03:21 AM
i am created new table with below columns.
1. program manager --> reference to program table
2. user --> reference to user table.
and similarly i have created few string fields.
1, program managers
2. user name
3. user email
my requirement is i need to populate program manager (reference) field value in the program managers (string)field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 03:31 AM - edited 10-25-2022 03:31 AM
You can write onChange client script with the below code on program manager reference field
//Inside the onChange() function paste the below code
if(newValue) {
g_form.setValue('<pass string_field_name>', newValue); //newValue is program manager reference field value
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 04:58 AM
need solution in BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 07:57 PM
You can try before/update business rule
(function executeRule(current, previous /*null when async*/ ) {
if(JSUtil.notNil(current.getValue('program_manager')) { //If program manager is not nil
current.setValue('program_managers', current.program_manager.name); //Set the string field with program manager name
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 03:35 AM
Hi @siva58 ,
If you are trying on the catalog item use Catalog Data Lookup Definition.
Refer below article use can easily populate the values based on the other reference fields.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar