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

UNSAccountB - Write permission denied for value "User account is disabled"

We've a script to enable UNSAccountB called TSB_UNSAccountB_Insert. It's a part of a process:

When executed from process in return we get:

<e>2017-08-01 14:34:55 +02:00 - \IDMTEST - VI.JobService.JobComponents.ScriptComponent - 7dff7548-c2fe-4e4f-bf5d-8a5a2b2c1190: Errors occured
    Optimizing by using the existing connection.
    [810222] Error executing script 'TSB_UNSAccountB_Enable'.
    [810025] User accounts: Write permission denied for value "User account is disabled".

When script is executed from Designer\Object Browser everything is OK.

PS. Weird thing is that someday ago it was working fine in a process too.

1602.TSB_UNSAccountB_Enable.txt
Public Function TSB_UNSAccountB_Enable(ByVal AccountName As String, ByVal Ident_UNSRoot As String) As Boolean

	Dim f As ISqlFormatter = Connection.SqlFormatter
	
	Dim UNSAccountB As IEntity = Nothing
	Dim UID_UNSRootB As String = Connection.GetSingleProperty("UNSRootB", "UID_UNSRootB", f.Comparison("Ident_UNSRoot", Ident_UNSRoot, ValType.String, CompareOperator.Equal))

	If Session.Source.TryGet( Query.From("UNSAccountB") _
							       .Where(f.Comparison("AccountName", AccountName, ValType.String, CompareOperator.Equal, FormatterOptions.NonUnicodeLiterals)) _
							       .Where(f.Comparison("UID_UNSRootB", UID_UNSRootB, ValType.String, CompareOperator.Equal, FormatterOptions.NonUnicodeLiterals)) _
							       .SelectNonLobs, UNSAccountB ) Then
		
		UNSAccountB.PutValue("AccountDisabled", False)
		
		Using uow As IUnitOfWork = Session.StartUnitOfWork()
	        uow.Put(UNSAccountB)
	        uow.Commit()
	    End Using
		
		Return True
	End If
		
	Return False
		
End Function

  • Two things that could have happened.

    You are using Value = QBM_GetCurrentUserAuth(ConnectionInfo) as AuthenticationString parameter so that the script will be using the authentication string from the user that generated the process.

    When you are testing in the ObjectBrowser, are you using the same user as in the failed process? That could explain the differences in the permissions.

    Secondly, the user account could be marked for deletion already. In that case, you are not able to change the property as well. Check the property XMarkedForDeletion at the acccount.