How to auto populate user fields from scoped Application

Vishnu priya2
Tera Contributor

Hi All,

I have created an Application.I have a field called Submitter Name from User table.Based on the submitter name, I need to autopopulate other fields (location,department,employment status and email) from the user table.I have included my script include and client script.When I try to select submitter name I am getting Error message-Access to script include blocked from application scope".I need your help to sought this out.

 

Thanks,

Vishnu Priya

 

Vishnupriya2_2-1690380608541.png

 

 

Vishnupriya2_0-1690380328923.pngVishnupriya2_1-1690380428299.png

 

3 REPLIES 3

Zach Koch
Giga Sage
Giga Sage

As an admin, in the navigation bar, go to the script include section, search commonUtils, and make sure the  Accessible From field is set to All Application Scopes

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Hi Zach Koch,

Thanks for the solution it worked .But I'm getting undefined value in the employment_status field.In Alert I can see the value for employement status as FT,but in employment status field I'm getting as undefined .It would be great if you could help me with the solution.

 

Thnaks,

Vishnu Priya V

 

Vishnupriya2_0-1690443864836.png

 

 

 

Zach Koch
Giga Sage
Giga Sage

If I am looking at your picture correctly, it doesn't look like any of the values are being set correctly. Your Info message says department should be 7m07 - it admin, but the department is 4A57-TCH Infrastructure.

 

In the picture you included, it looks like you need to declare your function below the getXMLAnswer call, not in it, and then put your created function as the argument inside getXMLAnswer. 

 

Here is the section I am referring to 

ZachKoch_0-1690470346511.png

Here is the ServiceNow docs page on getXMLAnswer. Take a look at how they declare their function below the getXMLAnswer call, then use it as an argument for the getXMLAnswer function.

ZachKoch_1-1690470477114.png

I have included a link to the docs page as well

Docs page 

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!