auto populated value not visible in list view after updating the value in referencing table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2024 01:45 PM
on table 'x' customer name field is referencing to customer table and auto populating vendor number field value, we created the record by selecting the customer to whom the vendor number is empty, after some days we are updating the vendor number in customer table, the same is reflecting in form, but the vendor field value is not visible on list view, its still showing empty in list view, for auto populating we used after business rule and following code is used in servicenow : (function executeRule(current, previous /*null when async*/) {
// Add your code here
current.account_number = current.customer_name.account_number;
current.region=current.customer_name.region;
current.vendor_number=current.customer_name.vendor_no;
current.company_code=current.customer_name.company_code;
current.account_currency=current.customer_name.customer_currency;
current.update();
})(current, previous);
Note: we are updating the vendor number is customer table after creating the record for the same customer.
first screen shot is on form, vendor showing number: 20, where as vendor number is not showing in list view,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 09:44 AM
This may not make a difference, but based on this script the Business Rule looks like one that can and should be run before Update, then remove the current.update(); line to remove an unnecessary update.