- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 05:18 PM
Hello experts,
I have read in some documentations that we can use the run script option of the transform map to create or populate a field not included in the excel file. Is it also possible to the password field of the user table? If so, do you have idea on how to do it and the script to make it?
Thanks and Regards,
Vaine
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 06:15 PM
@Rain Vaine try this
Setting the password field value through a transform row script is not recommended as the password field is encrypted and requires specific functions to set its value. Instead, it is recommended to use the default_password system property to set the default password value for new users.
Here's an example of how to set the default_password property:
- Navigate to System Properties > System.
- Search for the glide.security.default_password property.
- Set the value of this property to the desired default password.
- Save the property.
Now, whenever a new user is created, the default password will be set automatically.
Best practices for importing users from an Excel sheet include:
- Use a transform map to map the fields from the Excel sheet to the user table.
- Use the setPassword() function provided by the GlideRecord API to set the password value for each user.
Here's an example of a transform row script that imports users from an Excel sheet and sets their password:
(function transformRow(source, target, map, log, targetImportSetRow /*undefined on insert*/) { // Import fields from Excel sheet using source object target.setValue('first_name', source.first_name); target.setValue('last_name', source.last_name); target.setValue('email', source.email); // Set default password for new users var defaultPassword = gs.getProperty('glide.security.default_password'); target.setPassword(defaultPassword); })(source, target, map, log, targetImportSetRow);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 06:49 PM
Hello,
Thanks for this another approach. I was able to make it work with transform functions script