Is it possible to write a SuiteScript that notifie...
# suitescript
b
Is it possible to write a SuiteScript that notifies the administrator whenever a customer edits their own record in Netsuite when they are signed into the Customer Portal? I already have a simple User Event 2.0 script that notifies the administrator whenever an employee edits a customer record, I checked “Execute in Commerce Context” in its deployment, I’m not sure what else I can do to trigger this script from a Customer role?
n
Just do a check that if the record id is equal to the current user's id. Something like runtime.getCurrentUser() would give you user ID of the person updating the record. And CurrentRecord.id/record.id would give you the record(customer being edited) id. Compare them and you will see if it's the same person or not.
b
Sorry I don’t think I’m explaining myself correctly. My script is just a generic afterSubmit function that sends an email, and it’s only being triggered by employees. I have no conditional clauses, it’s just literally only being triggered by anyone but customers. My script is deployed with a status of “Release”, I have the “Execute in Commerce Context” checkbox checked, and I have my Audience set to all roles. What else should I check for?
s
create a simple saved search and schedule it
b
What kind of saved search? I’ve already tried creating a System Note but don’t see instances of customers editing customer records, only employees editing customer records.
*a System Note saved search
p
“Execute in Commerce Context” is not required, but there is field EXECUTE AS ROLE need to set as "Administrator" and just select the Role as "Customer Center" is enough. Then it will work. Since you are running through customer center, the script should run with Administrator privileges.
"Execute in Commerce Context” is required for commerce website users. Your case is applicable if customer edit the same in webstore.
s
No create a normal search and schedule it so whenever anything it will notified to admins
b
the admins don’t want to know when an employee edits a customer record, they only want to know when a customer edits a customer record
Thanks prasad… on the deployment I set EXECUTE AS ROLE as “Customer Center” however my script still doesn’t trigger when a customer (with a role of “Customer Center”) edits their own record
p
What if we select All Roles?
b
didn’t see an All Roles option, but I just tried it with “Full Access”, and still my script isn’t being triggered by Customer Center users. hmm…
p
Please go to "Script Deployment" >> "Audience" >> All Roles (Checkbox and need to enable this)
b
Yeah I already had the audience set to all roles, I tried to make my script as inclusive as possible so it’s triggered. But again it’s only being triggered by Employees and not by Customers. Can you think of anywhere else I should look?
s
Try to select the partner as well and try
b
I already have “select all” checked even though Partners is empty. Is the Customer Portal just permanently walled off from scripting? This is just weird, not sure what else to try