Get Unique IDs of Group Members

From SMTX Wiki
Jump to navigation Jump to search

If an actor is a group, and you want to show it in the Service Catalog under 'My Approvals', you need the unique IDs. to get those unique IDs, based on the Group name, use this javascript in a step of the type 'Execute Javascript':

var persongroupname = #groupname#; if (persongroupname) {

   var persongroups = JSON.parse(CommonInterface.getPersonGroupsByName(persongroupname));
   if (persongroups && persongroups.length) {
       var persons = JSON.parse(CommonInterface.getPersonsForPersonGroup(persongroups[0].id));
       if (persons) {
           return persons.map(function (person) { return person.uniqueid; }).join("||");
       }
   }

} return "";

You can then send this over to the Service Catalog with this WebService: WS: Services: mark service publish request as in approval state