DESCRIPTION
This script sample demonstrates how to copy additional attributes on user copy.
In script sample, change arrAttributeList to list of your additional attributes
Note This code may use functions from the ARS Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT QUEST PROFESSIONAL SERVICES.
'*********************************************************************************
'
' This code is published on the ActiveRoles Script Center:
' http://communities.quest.com/docs/DOC-9991
'
' This code may use functions from the ARS Script Policy Best Practices:
' http://communities.quest.com/docs/DOC-10016
'
' Please, follow the link to obtain instructions and code for those functions.
'*********************************************************************************
Option Explicit
Dim arrAttributeList
arrAttributeList = Array("attrib1", "attrib2")
'**************************************************************************
' EVENT HANDLERS
'**************************************************************************
Sub onPostCreate(Request)
'-- skip for another classes
If (LCase(Request.Class) <> LCase("user")) Then Exit Sub
'-- skip non copy requests
If (CInt(Request.Parameter("Type")) <> EDST_REQ_COPY) Then Exit Sub
Dim SrcObj, strAttrib, Value, rootDSE
'-- get source object
Set rootDSE = GetObject("EDMS:")
Set SrcObj = rootDSE.OpenDSObject("EDMS://" & Request.GetInControl(EDS_CONTROL_SOURCE_OBJECT_DN), "", "", 0)
'-- copy additional attributes
Call SrcObj.GetInfoEx(arrAttributeList, 0)
For Each strAttrib in arrAttributeList
'-- get source
On Error Resume Next
Value = Empty
Value = SrcObj.Get(strAttrib)
On Error Goto 0
'-- apply to destination
If (Not IsEmpty(Value)) Then
Call DirObj.Put(strAttrib, Value)
End If
Next
'-- apply changes
Call DirObj.SetInfo()
End Sub ' onPostCreate
'***** END OF CODE ***************************************************************
COMPATIBILITY
Script compatible with the following version(s): <Not specified>