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