How to store data in a config parameter from a script

I want to store data like an access token and the exp. time in an config paramter so I don't have to request a new token for every call.

I know I can reach the parameter with somethign like: 

Dim paramExp = Session.Config.GetConfigParm(tokenExpPath)

But this property is read only so I cannot put a new value in it with this method.

Can somebody provide me a script example of how to retrieve a config parameter and put a new value in it from a script?

Parents
  • Hi,

    As long as it is a config parm in the 'Custom' container, I would be inclined to do a 'HandleObjectComponent - Update' to update the value.

    If you 'must' do it in a script, then you will need to get the CP as an iEntity, perform a PutValue to update the value, then a Put of the iEntity to write it back to the DB.

    HTH, Barry.

  • Hello Barry,


    Thanks for your fast response!

    I figured I made a mistake in the getting the IEntity, that's why it wasn't working. 

    Dim configParm As IEntity = Session.Source.Get("DialogConfigParm", <UID_ConfigParm>)
    configParm.Session.PutValue("Value", <Value>)
    configParm.Save(Session)

    Just leaving the code if someone searches, however it's just standard use of the OL

Reply
  • Hello Barry,


    Thanks for your fast response!

    I figured I made a mistake in the getting the IEntity, that's why it wasn't working. 

    Dim configParm As IEntity = Session.Source.Get("DialogConfigParm", <UID_ConfigParm>)
    configParm.Session.PutValue("Value", <Value>)
    configParm.Save(Session)

    Just leaving the code if someone searches, however it's just standard use of the OL

Children
No Data