Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to auto populate fields on a form from client script and open it in workspace ui ?

Snehal13
Kilo Sage

Below client script code opens new record on user table in agent workspace UI but I also want to auto populate fields like first_name, department, title on the user form that opens in agent workspace UI 

Currently, form opens but fields are not getting auto populated

 

 

var url = "now/workspace/agent/record/sys_user/-1/first_name=testing";
top.window.open(url);

 

 

How to do that ?

 

1 ACCEPTED SOLUTION

Below client script code opens new record on user table in agent workspace Ui but I also want to auto populate fields like first_name, department, title on the form that opens. 

 

 

var url = "now/workspace/agent/record/sys_user/-1/first_name=testing";
top.window.open(url);

 

 

 

View solution in original post

9 REPLIES 9

Badal Khojare
Mega Sage

Hi @Snehal13 ,

Please check this link: https://www.servicenow.com/community/developer-articles/auto-populate-user-details-using-ajax/ta-p/2...

 

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023

I want to open and not parse 

below is client script code 

var url = https://<InstanceURL>/sys_user.do?sys_id=-1&sysparm_view=Workspace&sysparm_query=short_description=testing&department=<sys id from script>

 

openUrl(url);  
department is not getting auto populated

Vishal Birajdar
Giga Sage

Hi @Snehal13 

 

If possible can you share your code...!!

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Client script code below

 

var url = https://<InstanceURL>/sys_user.do?sys_id=-1&sysparm_view=Workspace&sysparm_query=short_description=testing&department=<sys id from script>

 

openUrl(url);