Why Auto-Population Doesn't Work for Child Form on Mobile (and How to Fix It)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Overview
Auto-population in ServiceNow Mobile Apps often fails—not because of script issues—but due to incorrect table mapping between the Mobile function and the Mobile Action Item.
Mobile auto-population behaves differently from the desktop UI. For the value to populate correctly, the Mobile function must reference the parent table, while the Mobile Action Item and Mobile Input Form must reference the child table where the field actually exists.
If these table mappings don’t match, the mobile form cannot receive or apply the value, causing the auto-population to silently fail.
This article explains how to correctly configure auto-population using your real use case:
Auto-filling the Account field on the Interaction (interaction) form when creating an Interaction from an Account (customer_account) record in the mobile app.
Why Auto-Population Fails on Child Forms
Cause 1: Incorrect Mapping Between Script Include Function and Action Item
This is the most common root cause.
When auto-populating a child table field from a parent table record, the mapping must follow this rule:
| Mobile Function | Parent table (Account) |
| Mobile Action Item | Child table (Interaction) |
| Mobile Form Input | Child table (Interaction) |
If these point to the wrong tables, the mobile app will not pass the parent record to the script → and the value will never auto-populate.
Cause 2: The Function Doesn’t Return the Field in the Correct Mobile Format
Mobile input fields require the Script Include to return an object with:
Value → sys_id
DisplayValue → label shown in the field
Returning only a sys_id (standard desktop behavior) will fail on mobile because the mobile UI cannot interpret the display value.
Cause 3: Script Include not marked as "Mobile Callable"
Mobile requires Script Includes to be explicitly accessible.
If Mobile Callable is not enabled, the Mobile Agent app cannot execute the function—even if it works in the desktop UI.
Use Case
Populate a Account value on the Interaction form in Mobile
Create a Script Include:
1. Must return both Value and Display Value.
2. Must be Mobile Callable
var AutopopulateUtils = Class.create();
AutopopulateUtils.prototype = {
initialize: function() {
},
getIncidentInfo: function() {
var inc = new GlideRecord('incident');
if (inc.get(current.sys_id)) {
//gs.log(current.sys_id);
return {
"Value": inc.getUniqueValue(),
"DisplayValue": inc.getDisplayValue() // incident number
};
}
},
type: 'AutopopulateUtils'
};
Configure Mobile Input Fields:
1. Create an Account Variable and set the variable type to Scripted.
2. Create a Variable Attribute and choose the attribute Script, reference the Script Include function.
3. Link the variable in the Mobile Input Field. Under the Autofill variable option, select the Assignment Group variable you created.
Result
Once configured, the Account field will automatically populate with the predefined value when you open the form in the mobile app. This approach ensures consistent and reliable field population across ServiceNow Mobile environments.
- Labels:
-
Auto Population on child form
