This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Object created with "Custom" rights

Hey guys, I'm using the script below to create a object in the "AfterCreateNewObjectFinalize" event handler.

Everything in the script works as intended but I noticed that the object created via the script has "Custom" set as their object access rights, as seen in the picture below.

How can I correct this so all objects created with the script uses the normal NACL that is default for the object/class type?

'Henter lookup iden til nåværende klasse og objekt id'en
Dim classID : classID = PropertyValues.SearchForProperty(100).TypedValue.GetLookupID
Dim currentObjID : currentObjID = DisplayID

'Oppretter saken hvis "Rådsmøte" klassen er opprettet
If classID = 31 Then
	
	'Oppretter de nødvendige hjelpevariablene
	Dim oPropVals: Set oPropVals = CreateObject("MFilesAPI.PropertyValues")
	Dim oOnePropVal: Set oOnePropVal = CreateObject("MFilesAPI.PropertyValue")
	Dim oFiles: Set oFiles = CreateObject("MFilesAPI.SourceObjectFiles")
	Dim oACL: Set oACL = CreateObject("MFilesAPI.AccessControlList")
	
	'Deklarer objekttype id'en til saken vi skal opprette
	Dim creationObjectID: creationObjectID = 176

	'Deklarer hvilken klasse det nye objektet skal tilhøre
	oOnePropVal.PropertyDef = 100
	oOnePropVal.TypedValue.SetValue MFDatatypeLookup, 32
	oPropVals.Add -1, oOnePropVal

	'Deklarer lookup id'en på rådsmøtet denne skaen tilhører (nåværende objekt)
	oOnePropVal.PropertyDef = 1327
	oOnePropVal.TypedValue.SetValue MFDatatypeLookup, currentObjID
	oPropVals.Add -1, oOnePropVal

	'Deklarer navnet på det nye objektet som skal opprettes
	oOnePropVal.PropertyDef = 0
	oOnePropVal.TypedValue.SetValue MFDatatypeText, "12. Oppmuntring og støtte"
	oPropVals.Add -1, oOnePropVal
	
	'Oppretter objektet
	Call Vault.ObjectOperations.CreateNewObjectEx(creationObjectID, oPropVals, oFiles, False, True, oACL)

End if

Parents
  • Hello,

    In API documentation:

    The access control list for the new object.

    In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.

    So This should be called:

    Call Vault.ObjectOperations.CreateNewObjectEx(creationObjectID, oPropVals, oFiles, False, True, nothing)

    also you can try:

    Vault.ObjectOperations.ChangePermissionsToNamedACL(ObjVer, IDofNACL, true);

Reply
  • Hello,

    In API documentation:

    The access control list for the new object.

    In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.

    So This should be called:

    Call Vault.ObjectOperations.CreateNewObjectEx(creationObjectID, oPropVals, oFiles, False, True, nothing)

    also you can try:

    Vault.ObjectOperations.ChangePermissionsToNamedACL(ObjVer, IDofNACL, true);

Children
No Data