[Solved] Push new lead to Salesforce and retrieve lead ID in survey?



If you use an API to create a lead in Salesforce you can obtain the ID of the new lead using sr[0].id, is it possible to have SG get the lead ID once it has created it?

For example, user gives details on page 2, Salesforce action to create lead on this page. The lead ID is then recorded in a hidden question on page 3, details further in the survey are then updated to that Salesforce lead using another Salesforce action.

Alternatively has anyone done a Salesforce push through scripting instead of the plugin?


Paul Clarkson378376 asked

    Best answer


    Hi Paul!

    I am no expert on Salesforce, but I have had the chance to work with some smart people on some complex Salesforce integrations. To the best of my knowledge, it is not possible to acquire the ID of a new object created via a Salesforce push action.

    A surrogate key

    The solution I see most often is to generate your own unique ID for the object you are about to create, perhaps by using a Hidden Value action and the “random number” option. You would pass this unique ID in your Salesforce push action, storing it with the new object. Later, when you need to fetch or update that object, you have a unique id (a ‘surrogate key’) you may use in your query.

    Scripting a Salesforce integration

    Of the two types of scripting possible in SurveyGizmo, I can speak more authoritatively to the PHP-based “Custom Scripting actions”. Only the functions listed in the Custom Scripting documentation are available (https://script.surveygizmo.com/help/article/link/sg-functions), which is missing any network communication functionality (outside of basic email sending).

    (as an aside, it is possible to interact with an HTTP Connect action from a Custom Script, which would allow you to make HTTP requests to external resources. This can be made to work if the API you are working with supports the GET or POST method with the x-www-form-urlencoded Content Type.)

    The other scripting option is Javascript. SurveyGizmo does not enforce any restrictions on your Javascript, however security is a concern for any code running client-side (exposed credentials/etc). My intuition is that Salesforce would not allow client-side/cross domain API requests, but a brief Google search tells me I may be wrong about that.

    I hope this information is helpful

    Nathan - Survey Astronaut answered


      Question stats

      • Active
      • Views3613 times
      • Answers1 answer
      • Followers0 followers