VMware Cloud Community
ejz123
Contributor
Contributor

OOTB workflow contains leading and trailing delimiters. How can I strip them out?

When attempting to use an OOTB workflow (Create_a_user_group_in_an_organizational_unit), the workflow fails with the following error:

The following component requests failed: Create_a_user_group_in_an_organizational_unit_1. Unable to convert object, '#_v2_#,#UserGroup#,#8593bfaa-6376-4f90-a4bd-8314e96b0224#,#CN=[\"******\"],OU=****,OU=****,DC=****,DC=****#' plugin unexcepted exception : null

The object is created in AD, but with all of the leading [\" and trailing \"].  (AD doesn't like this!). The generated machine name is correct, just has leading and trailing delimiters.

I'm calling the workflow from the blueprint output of Machine Name. 

Any thoughts on how to strip those characters out would be greatly appreciated.

Reply
0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Hi,

In Javascript, when you want to strip some string(s), you can use the method String#replace(). Check, for example, the following page - https://www.w3schools.com/jsref/jsref_replace.asp

In your case, it looks like you need to do a one-time replacement of a leading/trailing delimiter with an empty string, so code like the following sample should work:

var name = "[\"mymachinename\"]";

System.log("before: " + name);

name = name.replace("[\"", "").replace("\"]", "");

System.log("after: " + name);

One option is to duplicate the OOTB workflow you are using, then you can insert an scriptable item (before item that calls the action createUserGroup) containing a code similar to the above to strip the unwanted delimiters from the input parameter name.

Reply
0 Kudos