Skip to content

Commit 84fefd6

Browse files
Replace Text (#1460)
* readme.md * script.js * readme.md * readme.md
1 parent c8c0892 commit 84fefd6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Purpose of the script is to help replace text IT_SAP with IT_ERP for all the Groups in Group table containing IT_SAP as keyword.
2+
It uses replace method which follows format replace(/'ABCD'/g,'PQR')
3+
where ABCD is to be replaced with PQR
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var replacemyname;
2+
var replaceis=new GlideRecord('sys_user_group');
3+
replaceis.addEncodedQuery('nameLIKEIT_SAP');
4+
replaceis.query();
5+
while(replaceis.next())
6+
{
7+
replaceis.name=replaceis.name.replace(/IT_SAP/g, 'IT_ERP'); // /IT_SAP/g is oldvalue 'IT_ERP' is new value
8+
replaceis.update();
9+
}

0 commit comments

Comments
 (0)