hi , Ive a use case to update all the script recor...
# suitescript
s
hi , Ive a use case to update all the script record's owner to a different user (a notification group ) . Is there a way to update in bulk? any scripting solution ? Kindly advice
n
Updating the owner or updating who is notified when the script errors?
s
We donot want the script owners to be the past employees of the organisation. So wanted to update the owner
n
You can update the owner field to the employee you need. You can do this easily enough with a search / query and iterate the results using submitFields to set the "owner"
Simple search to identify those scripts where the owner is "1234"
Copy code
const scriptSearchObj = search.create({
   type: "script",
   filters:
   [
      ["isinactive","is","F"], 
      "AND", 
      ["owner","anyof","1234"]
   ],
   columns:
   [
      search.createColumn({name: "internalid", label: "Internal ID"}),
      search.createColumn({name: "owner", label: "Owner"})
   ]
});
Iterate the results and do:
Copy code
record.submitFields({
    type: 'script',
    id: the_Record_Internal_ID,
    values: {
        owner: the_Updated_Employee_ID
    }
});
s
Thanks @NElliott, let me try this
n
You could try it with one record to start with in the console / debugger. I tried it directly loading a script record and updating it myself it worked fine, I see no reason why the approach above would not work for you.