Skip to main content

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

Contacts View PCF Control

  1. Overview The ContactsControl component is a custom PowerApps control that displays a searchable and sortable table of contact records. It provides an interactive UI for filtering and selecting records. 2. Functionalities Search Feature: Allows users to filter records by entering text. Sorting: Clickable column headers enable ascending/descending sorting. Record Selection: Users can select a record to trigger a modal alert. Dynamic Rendering: Updates view dynamically based on search and sort input. Custom Styling: Uses external CSS for styling. 3. Component Structure Main Container ( HTMLDivElement ) : Holds the search bar and table. Search Input ( HTMLInputElement ) : Enables real-time search. Table ( HTMLTableElement ) : Displays the records with sortable headers. Modal Alert ( HTMLDivElement ) : Displays selected record details. 4. Implementation Details 4.1 Initialization ( init Method) Sets up the main container. Loads external styles. Creates...

Attachment PCF

Overview The AttachmentControl component is a PowerApps Component Framework (PCF) control designed for handling file uploads. It supports multiple file uploads, drag-and-drop functionality, file previews, and base64 encoding for easy data handling. Features Supports multiple file uploads Drag-and-drop functionality File type and size validation Base64 conversion for uploaded files Preview support for images, PDFs, and text files File removal functionality Code Breakdown Importing Dependencies import { IInputs, IOutputs } from "./generated/ManifestTypes"; The component imports IInputs and IOutputs from the generated manifest file to define the control's input and output types. Component Definition export class AttachmentControl implements ComponentFramework.StandardControl<IInputs, IOutputs> { Defines the AttachmentControl class, implementing the StandardControl interface from PCF. Class Variables private container: HTMLDivElement; private fileInput: HTMLInputEl...

Trigger JavaScript on Click of Button PCF Control

  Overview The TriggerJavascript control is a custom PCF (PowerApps Component Framework) control that renders a button with customizable label, icon, and on-click script execution. The control allows users to dynamically trigger JavaScript code upon clicking the button. Dependencies IInputs, IOutputs from ./generated/ManifestTypes (Auto-generated types from PowerApps) CSS styling from ./CSS/TriggerJavascript.css Class: TriggerJavascript This class implements ComponentFramework.StandardControl<IInputs, IOutputs> and manages rendering a button inside a container, dynamically executing JavaScript code on button click. Properties Private Properties _container: HTMLDivElement - A reference to the container element where the button will be rendered. Methods constructor() Initializes a new instance of the TriggerJavascript control. init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLD...