bjoseph

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-15
18:12
4061 views
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
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
1 Solution
Accepted Solutions
lmattie

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-16
00:44
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 )
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 )
6 Replies
lmattie

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-15
23:15
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 );
var addlUsers = GetFieldValues( "ADDL_USER_FIELD" );
var curUsers = GetFieldValues( "EXISTING_SECONDARY_OWNERS" );
var allUsers = curUsers.concat( addlUsers );
SetFieldValues( "EXISTING_SECODARY_OWNERS", allUsers );
bjoseph

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-16
00:21
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
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
lmattie

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-16
00:44
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 )
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 )
jmalin

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-22
00:52
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.
lmattie

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-22
01:00
That is correct. However, I usually remove the duplicates myself as well. 🙂
bjoseph

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-16
01:16
Thanks Lot. Its Worked !!