How to Autofill the reference field in Mobile?
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎06-09-2024 06:29 PM
Hi
I created a script to autofill the contact field with the user
System Definition > Script Includes
var GetDefaultContactValue = Class.create();
GetDefaultContactValue.prototype = {
    initialize: function() {},
    getDefaultValue: function() {
        var userId = gs.getUserID();
		var userName = gs.getUserDisplayName();
        return {
			"Value" : userId,
			"DisplayValue" : userName
		};
    },
    type: 'GetDefaultContactValue'
};
Executable scripts
new sn_csm_mobile.GetDefaultContactValue().getDefaultValue();
This will not be executed.
Please tell me what is wrong with this script
I referenced these articles
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1166399
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎04-08-2025 04:00 AM - edited ‎04-08-2025 04:04 AM
Hi @Rosfield ,
Autofill variable can also be done through creating a function, u need to provide the input form screen and give the input and variables
Under the Autofill variable select the variable that you have created.
Thanks
