Suitelet call not working on button click

Scenario:

When adding buttons in the suitelet using HTML code. On the button click, it should redirect to another suitelet page, but it is redirecting to a blank page.

Solution:

This will happen when we use <button>tags and not mentioning the type properly. So that, it will work like default submit action.

Mention the button type as type=”button” in the html code.

<button type="button" class="custom-button" id="create-lead-button">

      Create Lead

    </button>

<script>

  document.getElementById("create-lead-button").addEventListener("click", function() { setTimeout(function() { window.location.href = "' + companyUrl + "/app/site/hosting/scriptlet.nl?script=" + scriptId + "&deploy=" + deploymentId + '"; }, 1000); });

</script>

Leave a comment

Your email address will not be published. Required fields are marked *