Salesforce Plugin presets - set details dynamically

Alun
Alun Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 20 ✭✭✭✭

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.

Answers

  • wlukusa
    wlukusa Dataiker Posts: 8 Dataiker
    edited July 17

    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 !

  • Alun
    Alun Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 20 ✭✭✭✭

    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?.

  • wlukusa
    wlukusa Dataiker Posts: 8 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.

Setup Info
    Tags
      Help me…