Big news! The community will be moving to a new platform April 21. Read more.
Big news! The community will be moving to a new platform April 21. Read more.
Absent Member.
Absent Member.
4061 views

How to add / append multisuer field's Selection to Existing Secondary Owners list ?

Jump to solution
Hi Experts,


I am trying to write an action script.

I am having an optional multiuser field on the form. User may or may not select multiple users from this field.

If User is selecting user names from this field , I want append those user names to Existing Secondary Owners.

I can not over write existing Secondary Owner. I want to append the selection of multiuser field to existing Secondary owners.


Please let me know , how to do this .:(


Thanks in advance,

Bijoy
0 Likes
1 Solution

Accepted Solutions
Absent Member.
Absent Member.
AppScript solution (you might want to add error checking) - not tested and both multi-user fields need to be set up the same way:

Call Shell.Item.GetFieldValue( "ADDL_USER_FIELD", addlUsers )
Call Shell.Item.GetFieldValue( "EXISTING_SECONDARY_OWNERS", curUsers )

If Len( curUsers ) <= 2 Then
curUsers = ","
End If

If Len( addlUsers ) > 2 Then
allUsers = curUsers & Mid( addlUsers, 2 )
Else
allUsers = curUsers
End If

Call Shell.Item.SetFieldValue( "EXISTING_SECONDARY_OWNERS", allUsers )

View solution in original post

0 Likes
6 Replies
Absent Member.
Absent Member.
Here is a JavaScript solution:

var addlUsers = GetFieldValues( "ADDL_USER_FIELD" );
var curUsers = GetFieldValues( "EXISTING_SECONDARY_OWNERS" );
var allUsers = curUsers.concat( addlUsers );
SetFieldValues( "EXISTING_SECODARY_OWNERS", allUsers );
Absent Member.
Absent Member.
Hi Lynn,

Thanks for the reply.

I am already having a Post submit transition action script which populates groups to secondary owner field based on Location selection.


Since it is Post transition call, JavaScript output is overriding.:(


Can we achieve the same thing using action script ? 🙂

Thanks,
Bijoy
0 Likes
Absent Member.
Absent Member.
AppScript solution (you might want to add error checking) - not tested and both multi-user fields need to be set up the same way:

Call Shell.Item.GetFieldValue( "ADDL_USER_FIELD", addlUsers )
Call Shell.Item.GetFieldValue( "EXISTING_SECONDARY_OWNERS", curUsers )

If Len( curUsers ) <= 2 Then
curUsers = ","
End If

If Len( addlUsers ) > 2 Then
allUsers = curUsers & Mid( addlUsers, 2 )
Else
allUsers = curUsers
End If

Call Shell.Item.SetFieldValue( "EXISTING_SECONDARY_OWNERS", allUsers )

View solution in original post

0 Likes
Absent Member.
Absent Member.
Lynn just to confirm, SBM has no concern with field values appearing multiple times in a selection... it just removes the duplicates on save to the DB, right? I've always tried to ensure uniqueness when adding values to a field when they may already be there... but in hindsight that's probably overkill if Serena already handles this under the hood.
0 Likes
Absent Member.
Absent Member.
That is correct. However, I usually remove the duplicates myself as well. 🙂
0 Likes
Absent Member.
Absent Member.
Thanks Lot. Its Worked !!
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.