Home  >  Article  >  Web Front-end  >  Use Client API Object model in Power Apps

Use Client API Object model in Power Apps

Patricia Arquette
Patricia ArquetteOriginal
2024-10-23 19:05:31593browse

Hello all Power enthusiasts, welcome to my another blog. The purpose of this blog is to go over how to implement standard user experience automation methods using Client Script API. You should use this particular client scripting API to implement your data interaction, form content changes, or app behavior updates. While writing your logic in JavaScript, keep in mind that, even if the form is built with standard HTML, direct manipulation of the form content is not supported. Client scripting creates an object model and methods for interacting with the various form components. This method assures that any changes to the layout or specific HTML used in form rendering do not disrupt your business logic.

Objectives:-

Tasks

  1. Prepare solution with the form
  2. Build the client script.
  3. Upload the script.
  4. Edit form.
  5. Test.

Prerequisites:-

  • Access to Power Platform with Premium connection.
  • Access to Power platform environment with sample apps enabled
  • Basic understanding of Microsoft Power Platform and experience in software development against the Microsoft stack and Visual Studio code.
  • Experience in administering solutions in Microsoft Azure is preferred.

Here’s a step-by-step guide to help you set up to implement Client script API in your model-driven applications in power platform.

Step 1: Prepare solution with the form.

  1. Log in to Microsoft Power platform.
  2. Select Apps from the left and select Start with a Page Design from the New App dropdonwn.
    Use Client API Object model in Power Apps

  3. Select Blank Canvas from Select a page design to start your app.
    Use Client API Object model in Power Apps

  4. Insert three text labels, two text boxes, one drop down list and a submit button.
    Use Client API Object model in Power Apps

  5. Publish the app.

Step 2: Create a Table

  1. Select Data>Add data>Create new table Use Client API Object model in Power Apps
  2. Select Start with a blank table from Create a new table screen.
  3. Add three columns named, Title with Single Plain Text as data type, Description with Multiple Plain Text as data type and NewWorkItem with Single Plain Text as data type. Provide any name to the table. Use Client API Object model in Power Apps
  4. Add a Patch() to add data to multiple records. In Power Apps, the Patch() function is used to create or update records in a data source. It’s a versatile function that allows you to modify specific fields without affecting other properties.
Patch('New tables', Defaults('New tables'), {Title:TextInput1.Text, Description:TextInput1_1.Text, NewWorkItem:Dropdown1.SelectedText.Value})

Step 3: Create a Power Automate Flow

  1. From the left side of the Power App studio, Select Power Automate and select Create new flow.
    Use Client API Object model in Power Apps

  2. Name your flow and select Create from blank. After add a next step by Selecting Azure DevOps and Create a new item. When it asks for a SignIn, please enter your credentials and get signed in.
    Use Client API Object model in Power Apps
    Use Client API Object model in Power Apps

  3. On the Create a new item step enter the following details:

    • Organization Name: Your Azure DevOps organization.
    • Project Name: Your Azure DevOps project.
    • Work Item Type: Tasks.
    • Title: FromPowerApps.
    • Description: FromPowerApps. Then select Save.
  4. Enter the following code on the Submit button's Onselect method.

DevOpsWorkItemflow.Run(TextInput1.Text, TextInput1_1.Text)

The two controls are for title and description. Publish the canvas app again.
You can run the Canvas app and submit a workitem into Your DevOps Project successfully.
You can use Microsoft Forms as well instead of Canvas App. In that case you dont need to configure a Dataverse table. For title and description you can take from the Forms parameters.

Hope you enjoy the session!!!

Thanks

The above is the detailed content of Use Client API Object model in Power Apps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn