You are viewing limited content. For full access, please sign in.

Question

Question

Adding user attributes via Workflow

asked on March 21, 2014 Show version history

Hey,

 

I am required to set up a large number of users, all of which require their e-mail address adding. It looks as if it's possible to assign attributes using SDK so I was hoping to add the attributes from a list. This would be great for us to update new starters.

 

Has anyone had any experience with this? 

 

I attempted the code but have so far had no luck.

 

Dim MySession as Laserfiche.RepositoryAccess.Session = me.RASession
Dim MyUserID as String = GetTokenValue("FindUser_ID")
Dim MyUser as Laserfiche.RepositoryAccess.TrusteeInfo = Trustee.GetInfo(MyUserID,MySession)

Try
    MyUser.GetAttributes.Add("[Workflow]E-mail","Test@mail.im")
    MyUser.GetAttributes.Save()
Catch
    MsgBox("Error")
End Try

 

Any help is appreciated. Thanks, Dom

 

0 0

Answer

SELECTED ANSWER
replied on March 21, 2014

The script you have here would fail to compile because GetAttributes is a function. Also, when you call GetAttributes twice, you get two separate instances, so you aren't necessarily actually saving your changes. Try something more like this:

 

Dim MySession as Laserfiche.RepositoryAccess.Session = me.RASession
Dim MyUserId as String = GetTokenValue("FindUser_ID")
Dim MyUser as Laserfiche.RepositoryAccess.TrusteeInfo = Trustee.GetInfo(MyUserID, MySession)

Try
    Dim MyAttributes As Laserfiche.RepositoryAccess.TrusteeAttributeCollection
    MyAttributes = MyUser.GetAttributes()
    MyAttributes.Add("[Workflow]E-mail", "Test@mail.im")
    MyAttributes.Save()
Catch
    MsgBox("Error")
End Try

 

 

0 0

Replies

replied on March 21, 2014

Side note, you want to take out the MsgBox from the Catch branch before this workflow goes live or it will not report any errors.

0 0
replied on March 24, 2014

Thanks  for the responses people, really appreciate it !

 

Yeah the MsgBox was purely for various tests within the script, I will probably change that to a settokenvalue in future :)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.