Auto-Populate field based on other field value selected on Mobile input form screen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 11:07 PM
On create new incident action in mobile agent application we have below requirement to implement.
When caller is selected auto-populate the user's business phone number in the contact field on the input form screen.
Anyone implemented this one or similar kind of functionality is configured? If yes, please help.
Thanks,
Sudhir G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 12:01 AM
HI @SudhirG ,
I trust you are doing great.
you can follow these steps:
Identify the appropriate field on the input form screen where you want to auto-populate the user's business phone number. Let's assume the field name is "contact_field."
Create a new Business Rule in ServiceNow to trigger when a new incident is created. This Business Rule will be responsible for populating the contact field.
Open the ServiceNow Studio and navigate to the "Business Rules" section.
Create a new Business Rule with a meaningful name, such as "Auto Populate Contact Field."
Set the appropriate conditions for the Business Rule to trigger. In this case, the condition should be when a new incident is created.
Add a script to the Business Rule to fetch the user's business phone number and populate it in the contact field.
Here's an example script that you can use as a starting point:
(function executeRule(current, previous) {
var callerID = current.caller_id; // Assuming the caller field is "caller_id"
var userGR = new GlideRecord('sys_user');
if (userGR.get(callerID)) {
var businessPhone = userGR.getValue('business_phone');
current.contact_field = businessPhone;
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 01:50 AM - edited 07-03-2023 01:50 AM
Hi @Amit Gujarathi ,
Thanks for the solution, We are looking for the field auto-population based on the onChange of other field value in mobile application.
Thanks,
Sudhir G