How to Add the button in Portal app by customize

there are many  steps in order to  add the button in portal apps.

  1. first add the  button in  code editor =>  



    <button onclick="send()" class="btn btn-primary" style="font-size: 16px; height: 50px; width: 70px; background-color: #302ce1; text-align: right;">Button</button>
  2. then  add the code in JavaScript which call by send event.  , so first  download the file  by call function name download.
  3. get the id from url then pass into json value.
  4. send the  https post request  to automate power flow .

 <script type="text/javascript">
      function send() {
        function download(filename, text) {
          var element = document.createElement('a');
          element.setAttribute('href''data:text/plain;charset=utf-8,' + encodeURIComponent(text));
          element.setAttribute('download', filename);
          element.style.display = 'none';
          document.body.appendChild(element);
          element.click();
          document.body.removeChild(element);
        }
        // Start file download.
        download("hello.txt""This is the content of my file :)");
        var queryString = window.location.search;
        var parameters = new URLSearchParams(queryString);
        var value = parameters.get('id');
        alert(value)
        var person = {
          "accountid""value",
          "reportid""87687-7878"
        }
        $('#target').html('sending..');
        $.ajax({
          url: 'https://prod-144.westus.logic.azure.com:443/workflows/7e377ec7490743d292f204556b97144d/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=byXsTddDa65LdvHQ4ragkgwSk90cKkmtM5pWBkgX9Sg',
          type: 'post',
          dataType: 'json',
          contentType: 'application/json',
          success: function(data) {
            $('#target').html(data.msg);
          },
          data: JSON.stringify(person)
        });
      }

Comments

Popular posts from this blog

Attachment PCF

Contacts View PCF Control

Trigger JavaScript on Click of Button PCF Control