does anyone know if it's possible to set customer ...
# suitescript
a
does anyone know if it's possible to set customer access to the customer center via suitescript, including their password? and whether it's also possible for the contactroles sublist?
a
You can definitely UNSET access using SuiteScript. I've done that. I imagine the reverse would be true. As far as setting password, I'm not sure. What you might consider if it is scriptable, is to set an arbitrary value for password, and rather than sending the "notify customer" email, send a custom email that encourages the user to use the "forgot password" to reset it to their own value.
A lot of our customers use this process to grant access, because the 'notify customer' checkbox sends an email branded by Oracle. It looks like phishing if you can't brand it for the actual site you're granting access to. 😕
a
thanks, this is really helpful!
a
Copy code
Below is the logic how to set the password.

customer = record.load({type:'customer',id: custId, isDynamic: true});
customer.selectLine({sublistId:'contactroles', line: line});
        customer.setCurrentSublistValue({sublistId:'contactroles', fieldId:'password', value: password});
        customer.setCurrentSublistValue({sublistId:'contactroles', fieldId:'passwordconfirm', value: password});
        customer.setCurrentSublistValue({sublistId:'contactroles', fieldId:'giveaccess', value:true});
        customer.commitLine({sublistId:'contactroles'});
customer.save();
p
in contacts the second password field is passwordconfirm and in the main user it's password2... ROFLnetsuite
netsuite 1
a
lol that is good to know, thanks @PabloZ
thanks also @Arun Dasari for that code snippet - that is immensely helpful!