Is it possible to restrict users from creating pub...
# administration
h
Is it possible to restrict users from creating public email templates (we would like them to still create private templates)? Or at least change the default on email templates to have private checked? When looking in netsuite I was not able to find/modify an email template form.
s
set the role permission for Email template to view - List>Email Template =View
h
Will that allow the users to still create their own email templates for personal use? -Updated above message to be more clear
s
then set it to create - they can create but cannot edit
h
The issue at hand is we have too many public templates. We want people to be able to create private ones just not public ones.
Kinda like how saved searches default to private
s
then you can use a workflow to accomplish what you want with edit permission. Use the workflow to allow to edit the template if that user created it. Options are quite limitless with workflow.
👍 1
h
Workflow created!
s
@Hunter Jacobs did it work as intended ?
h
Unfortunately I am getting Failed to create or assign a workflow instance for record.
when we try to save the "new" template
s
set field value on exit after record saved
h
I eventually gave up and created an user event script that does it for me:
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 */
define(['N/record', 'N/log'], function(record, log) {
    
    function beforeLoad(context) {
        if (context.type !== context.UserEventType.CREATE) {
            return;
        }

        try {
            var newRecord = context.newRecord;
            if (newRecord.type === 'emailtemplate') {
                newRecord.setValue({
                    fieldId: 'isprivate',
                    value: true
                });
            }
        } catch (e) {
            log.error({
                title: 'Error setting isPrivate on Email Template',
                details: e.toString()
            });
        }
    }

    return {
        beforeLoad: beforeLoad
    };
});