Highlighted
Absent Member.. Absent Member..
Absent Member..
314 views

Mass update of SRC Items

Jump to solution

Dear folks,

I have a long list of SRC items (over 400) that use the "Open a Change" connector and I would like to update the assignment group the change ticket is assigned to.  How can I do this with a mass update (or via the Oracle database)?  The filename for the SRC item is a joindef file (joinsvcDisplay) and the field I want to update is presented as a variable ($assign.dept).

What's the best way to do a mass update of the contents of that variable?

Thanks,

Ulises

 

 

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Mass update of SRC Items

Jump to solution

AChandler,

God bless coffee! Just read it and I think this will work; your code assumes that all current items are assigned to one group, doesn't it?  So if I want to do something as "find me all the items assigned to X group and replace the group with Y" I'll need to update the initial query as indicated here:

var itemQ = "interface.type=\"Open a Change\"";

//If needed, further restrict the records updated

//by using this query to filter on other fields.

I will do that and I'll update the post with the results. 

Best regards,

Ulises

 

View solution in original post

0 Likes
4 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Mass update of SRC Items

Jump to solution

There's probably an existing JS somewhere in SM which can be called to replace an XML value, but after a quick glance I didn't see one. But I'm on coffee overload this morning, so I felt like writing something. 😉 This may not be the prettiest way to do this, but it works. Just save this in a ScriptLibrary somewhere, edit the two lines indicated, and Execute it.

var itemQ = "interface.type=\"Open a Change\"";
//If needed, further restrict the records updated
//by using this query to filter on other fields.

var replaceGroup = "NEW GROUP";
//Enter the new Assignment Group name.


var item = new SCFile("svcCatalog");
var iRc = item.doSelect(itemQ);

while (iRc == RC_SUCCESS) {

    var t = item.interface_info.indexOf("<assign.dept>");
    var i1 = t + 13;
    var i2 = item.interface_info.indexOf("</assign.dept>")
    var currentGroup = item.interface_info.substring(i1, i2);
    item.interface_info = item.interface_info.replace(currentGroup, replaceGroup);
    item.doUpdate();
    iRc = item.getNext();
   }

The Assignment Group which the Open a Change connector uses is stored in XML form (essentially) in the interface.info field of an svcCatalog record. The joinsvcDisplay file merges svcCatalog and svcDisplay records for viewing. So this script goes behind that to the actual svcCatalog to perform the updates.

Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Mass update of SRC Items

Jump to solution

AChandler,

God bless coffee! Just read it and I think this will work; your code assumes that all current items are assigned to one group, doesn't it?  So if I want to do something as "find me all the items assigned to X group and replace the group with Y" I'll need to update the initial query as indicated here:

var itemQ = "interface.type=\"Open a Change\"";

//If needed, further restrict the records updated

//by using this query to filter on other fields.

I will do that and I'll update the post with the results. 

Best regards,

Ulises

 

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Mass update of SRC Items

Jump to solution

Ulises Jorge Bido wrote: if I want to do something as "find me all the items assigned to X group and replace the group with Y" I'll need to update the initial query

 


Yes sir, something like this should do it:

var itemQ = "interface.type=\"Open a Change\" and index(\"OLD GROUP\",interface.info)>0";
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Mass update of SRC Items

Jump to solution

AChandler,

Just tested it and it worked!  Thanks a lot, this is an amazing solution.

Kind regards,

Ulises

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.