- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 09:38 AM
Hi all,
I tried auto populating the 'cost center' field value from users table, using the getReference method in business rule for incident form, but it didn't worked at all.
Please help me in retrieving the value of the cost center field value in the incident form
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:28 AM
Hi Naresh,
As suggested by Ankur above won't work in business rule as g_form.getReference() are client specific side options to be used.
Try using below business rule that runs After Insert on required table & make sure you have correct field name passed.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
current.location = current.caller_id.location;
current.cost_center = current.caller_id.cost_center;
current.state = current.caller_id.state;
current.city = current.caller_id.city;
current.country = current.caller_id.country;
current.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:42 PM
Did you mistakenly mark other answer as correct? As I see same script was provided before from my end.
Also don't use current.update()
it is not required if you use before insert/update BR
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:28 AM
Hi Naresh,
As suggested by Ankur above won't work in business rule as g_form.getReference() are client specific side options to be used.
Try using below business rule that runs After Insert on required table & make sure you have correct field name passed.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
current.location = current.caller_id.location;
current.cost_center = current.caller_id.cost_center;
current.state = current.caller_id.state;
current.city = current.caller_id.city;
current.country = current.caller_id.country;
current.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:36 AM
Hi Jaspal singh,
Thanks for your response.
But still state/province, street and cost center fields are not autopopulating.
Please help me
Thanks & regards
Naresh Uppu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:44 AM
Can you kindly confirm if
caller_id is a refrence field to User table.
Also, if fields state, location, cost-center exists on User table or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 10:51 AM
Yes it is referenced to the user table and there are state, location, cost center field on the user table.
I have added them manually but didn't created any duplicate fields.