- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2021 09:26 AM
Instead of single record below script is adding multiple records in table.
var s=new GlideRecord('u_empdata');
s.initialize();
s.setValue('u_first_name','John');
s.insert()
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2021 09:30 AM
How are you executing this script ?
Did you try to run on background script to test, i can see it will create only one record .
tested at my end on background script:
var s=new GlideRecord('sys_user');
s.initialize();
s.setValue('user_name','John');
s.setWorkflow(false);
s.insert();
Make sure you don't have any other script contradicting here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2021 09:30 AM
How are you executing this script ?
Did you try to run on background script to test, i can see it will create only one record .
tested at my end on background script:
var s=new GlideRecord('sys_user');
s.initialize();
s.setValue('user_name','John');
s.setWorkflow(false);
s.insert();
Make sure you don't have any other script contradicting here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2021 06:06 PM
Hi Harshvardhan
I tried mentioned script using Business Rules, Also I did this using Background Script also and creates only one record.
How this can be possible?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2021 09:44 PM
Can you add more details, in what scenario its creating multiple record.
as you have mentioned , while using it on background script it's creating one record. so I am assuming while using it on business rule, it's creating multiple record? if yes, have you checked any other existing server side script or business rule contradicting here ?
The script which you have shared is absolutely correct and it should create one record. You must have some existing script contradicting here , so I would suggest , please provide more details about your testing scenario.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2021 09:34 PM
Now my problem is Solved.....I just missed setWorkflow method.
Can you please tell more about setWorkflow. And how this helps me to solved my problem.