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

Error creatingf UNSAccountB: Write permission denied for value "Account definition"

Hi all,

I'm trying to create an UnsAccountBInUnsGroupB from script.

I have UNSGroupB, UNSRootB, TSBAccountDef.

But when I try to create a new UNSAccountB and set the account definition UID I get this error.

Same story with UID_TSBBehaviorDefault

Exception has been thrown by the target of an invocation.

at Designer.ScriptEditor.ScriptTestEditor.ExecuteScript(ScriptItem sItem)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
[810025] User accounts: Write permission denied for value "Account definition".
at VI.DB.Entities.PermissionsEntityColumnBase.<SetValueAsync>d__5.MoveNext()
at VI.DB.Entities.PermissionsEntityColumnBase._CheckCanEdit()

Here my code the script is triggered when an UNSGroupB is assigned to a Person:

account = connection.CreateSingle("UnsaccountB")
account.PutValue("uid_unsRootb",uid_unsroot)
account.PutValue("uid_tsbaccountDef",Connection.GetSingleProperty("tsbaccountdef","uid_tsbaccountdef", "ObjectKeyTargetSystem='<Key><T>UNSRootB</T><P>"+uid_unsroot+"</P></Key>'").ToString )
account.PutValue("uid_tsbbehavior",Connection.GetSingleProperty("tsbaccountdef","UID_TSBBehaviorDefault", "ObjectKeyTargetSystem='<Key><T>UNSRootB</T><P>"+uid_unsroot+"</P></Key>'") )

account.PutValue("uid_person",uid_person)
account.PutValue("cn",person.GetValue("InternalName"))
account.PutValue("Firstname",person.GetValue("Firstname"))
account.PutValue("Lastname",person.GetValue("Lastname"))
account.PutValue("CanonicalName",person.GetValue("CustomProperty01"))
account.Save
account.Load
uid_Account = account.GetValue("uid_unsaccountb")

I don't know why

Parents
  • Hi,

    you have to use the method AssignAccountDef at the UNSAccountB object.

    Parameters (in order) are:

    • uidPerson
    • uidTSBAccountDef
    • uidTSBBehavior

    Otherwise, you would have something like a chicken & egg problem.

    The system only allows you to assign account definitions the person is assigned to. So you have to assign the account definition to person first but without having the system trying to create a new account according to the definition.

    Oh, and you could try it in Object Browser if you like. Load any UNSAccountB object, open the properties and navigate to the Methods tab.

    Hth

Reply
  • Hi,

    you have to use the method AssignAccountDef at the UNSAccountB object.

    Parameters (in order) are:

    • uidPerson
    • uidTSBAccountDef
    • uidTSBBehavior

    Otherwise, you would have something like a chicken & egg problem.

    The system only allows you to assign account definitions the person is assigned to. So you have to assign the account definition to person first but without having the system trying to create a new account according to the definition.

    Oh, and you could try it in Object Browser if you like. Load any UNSAccountB object, open the properties and navigate to the Methods tab.

    Hth

Children
No Data