Script for pwd gen and putting value into ADSAccount UserPassword field

Hello,

I've created a script to generate the password taking the xobjectkey as input and returning the password.

Here's my script:

Public Function CCC_Generate_Password_AD(ByVal accountXobjectKey As String) As String
Dim entity As IEntity = Session.Source().Get(New DbObjectKey(accountXObjectKey))
Dim pwd As String = TSB_GetPassword(entity, "UserPassword", "ADS", $FK(UID_Person).CentralPassword$, True)
Return pwd
End Function

This script generate correctly the password and, before the return, I want to put this value into the UserPassword field of ADSAccount.

So the issue is, I don't know how to perform the PUT operation with this value into the UserPassword field of ADSAccount.

If I add a put before the return (for example Entity.put("UserPassword",pwd) or Base.put("UserPassword",pwd) it doesn't work.

The use case is that I need to use this script within a process.

Could you help me?

Thank you,
Elena

  • Hi Elena, 

    Options:

    • Most password management have been moved to the OnSaving scripts of the corresponding account tables. Please check these scripts for the ADSAccount, they might help you accomplish this, instead of a process.
    • To use a process, create a Handleobject update or sql process step and update the userpassword field of the table by calling your script and the xobjectkey. Please, see the ADS_Account_Insert process. It has a step to delete sensitive data that might guide you.

    Hth!