Salesforce Plugin presets - set details dynamically

alundavid
Level 3
Salesforce Plugin presets - set details dynamically

Hi community,

Is it possible to use the dataiku API to set the details of a " Salesforce login with Username-password" preset? 

Thanks in advance.

0 Kudos
3 Replies
wlukusa
Dataiker

Hi @alundavid

you can indeed use the Dataiku Python API to set a plugin settings if you have the appropriate authorizations. You can find more information about it here :  https://doc.dataiku.com/dss/latest/python-api/plugins.html#handling-settings

To modify the sales force settings you can probably use the following code

import dataiku
client = dataiku.api_client()
plugin = client.get_plugin("salesforce")

# Obtain the current settings
settings = plugin.get_settings()
raw_settings = settings.get_raw()

# Modify the settings (in your case presets) 
raw_settings['presets'] = [...]

# And save them back
settings.save()

Hope this helps ! 

alundavid
Level 3
Author

Thanks for that.

I'm particularly interested in setting the password programmatically (i.e. fetching the password from central safe storage and inserting it in the connection with no human involvement). How would that play out here? E.g. If the system over-writes the value of password in the 'config' dict with with the plain text fetched from the central sore, will it get encrypted by DSS?.

0 Kudos
wlukusa
Dataiker

Yes, if you modify the config via the API all secret fields are encrypted internally by DSS the same way they are when you save it manually from the UI. 

You can test that by changing the password via the API and fetching the settings again. The password field is encrypted in the response. 

 

0 Kudos