AutoNumber field in CDS | PowerApps

The most desired feature is ability to create/customize your own auto-number field. ANd CDS let’s your do just that!

I remember the good old days when I had to write a plugin to function for AutoNumber which used to configuration from a supposedly separate Configuration entity and it scary to maintain the code and entity. But this solves all that with so much ease!
allRecords

 

Create an AutoNumber field in CDS

  1. Now, you can start by creating a field in CDS’ Solutions > [YourSolution]> [YourEntity]
    createNew

  2. Then, under Accounts, you can see that you can actually create an Autonumber. This is not available in Classic UI.
    Also, please note that you’ll need to keep this field Not Required and Locked (on the form) in order to function.
    underTextGroup
  3. Give it  a suitable name and then you have 3 options to format your auto-number field.
    2TypesOfAutonumber

    String Prefixed number

    You’ll need to define the Prefix, Min Digits, Seed value
    preview

    Date prefixed number

    With Date prefixed, you’ll need to define Date Format, Min Digits of Seed Value
    dateFieldPreview

    Custom

    With custom, you can define the Format. Refer Microsoft’s Documentation for the same – AutoNumberFormat options
    customPreview

Save and Publish as you usually would and place your field on the form you want.

Working

I used String method to design my AutoNumber field. Let’s see how it looks –
Once I save the record, the Auto-number will be filled in.
fieldWorking

If you happen to delete any records already created in the sequence, the auto-number functionality will continue counting upward and not fill out previous backlogs/last deleted auto-number records.

 

Hope this helps!

Button Flow in Power Automate to replicate a Quick Create Form in D365 CE

I wanted to try a quick example of a Flow Button. I thought, why not make a simple Quick Create like form to enter data in Dynamics from Flow itself? So here’s a little form I did –

Create Button Flow in Power Automate

Now, let’s start of by creating a Flow button itself.

  1. Choose the template to create a Flow button.
    createFlowButton
  2. And give a suitable name and select the Flow trigger which is a button
    createAccountNew
  3. Now, select what input controls you want to add to the Flow Button. Click on Add Input and then select the Input you want to start off with
    addInput
    chooseControl
  4. Now, since in this example, I’m trying to create a simple Quick Create like form for D365, I’ll choose the most obvious fields I want and create the inputs as below
    buttonLayout
  5. Further, I’ll connect the same to CDS and Create a record in Dynamics using the input I receive from the Flow button, so – my CDS mapping in the Flow below looks like this –
    upperFlowBody
    I’ve mapped the Company Name and Annual Revenue fields.

    And now, I map the remaining Email address field to create my record.
    lowerFlowBody

    My Flow is now ready and after testing it, I’m ready to use it on my phone.

Run the Button Flow on Phone

On the phone app, make sure you have access to the Flow and navigate to Buttons on the screen-

  1. In Power Automate app, open the Buttons section and check for the Flow Button you created – Create Account in this case –
    buttonView
  2. Once you push the button, you’ll see the form you created with the input fields
    blankForm
  3. Finally, when you fill out the form, you’ll simply need to hit Done and that should be it.
    readyToSubmit

 

Check the Record in D365

Now, if you check in Dynamics, the record must’ve been created already!
record

 

Hope this quick tutorial helps!!

Adding a Canvas PowerApp to Teams

Let’s take a look at how you can simply export the Canvas App from your Organization and import it to Teams. And you should be good to go!

Exporting Canvas App

  1. Assuming you are an Admin and you have Owner/Co-Owner rights to the App, you can click the ellipses part on the App and look for Add to Teams option.
    addToTeams
  2. Once done, you can check on the right hand-side to see some details and Download the zip file of the Canvas App when ready
    downloadApp
  3. And that’s it, it gets downloaded like any other Model Driven/Canvas App solution file.
    downloaded

 

Importing App to Teams

  1. Now, you can import the same as a custom App in Teams. Navigate to the Apps section and look for Upload a custom app in menu as shown below.
    uploadACustomApp
  2. Now, chose the Org you want to import the solution file to. In my case, it’s just one organization, you may have multiple.
    selectOrg
  3. A dialog box will pop up to ask you to select the solution file, navigate to the saved location and pick the file.
    selectSolution
  4. And you’re ready. The App has been imported. You can see it in the Apps section under Built for CFT 146.
    findAppOnTeams

 

Adding App Per User

Each user needs to add the App themselves in order to be able to access it.

Also, remember that the user who is adding the App should have rights to access the App itself i.e. the App should be shared with those users.

Let’s say Kuldeep is another user in the CFT 146 Organization. He can explicitly search for the App and add it as below –

  1. Go to Apps, then look for the area, Build For <Org Name> and then look for the App that was imported.
    Attendees AppfindAppOnTeams
  2. Click on the App, and the dialog box will provide with a button to Add to Teams, along with other details mentioned alongside.
    clickAdd
  3. Once added, it will appear next in the left navigation menu and you can simply run it by clicking on it.
    appRunning
  4. In case the user doesn’t have appropriate rights on the App, they will see this message when trying to open the App in Teams.
    errorInAccessing

Hope this helps!! Happy 365ing!

Correctly connect to an Excel file in a Canvas PowerApp

Now, just putting an Excel with some crude data in it won’t really be identified in the Canvas App you are making. Perhaps you’re missing something.

Let’s say, I want to read an Excel file from OneDrive For Business into my Canvas App, I select the Excel file from the OneDrive for Business connection like below –

excelToConnect

But, I’m treated with the below error while making a connection – CanvasAppExcel

 

Correcting your Excel

Well, if your Excel looks like this –

crudeExcel

Then, that’s the reason Canvas App is not able to connect to the data in the Excel. Here’s what you need to do – click on the top left corner of where your Table should start from and then click on Table from the Insert tab as shown below
convertToTable

Confirm that diagonal end of the Table you want to consider and click OK once confirmed
confirmSelection

Once you confirm, you’re Excel data will look like this which is correctly formatted into a Table –
formattedTable

 

Reading the Table

Now that you’re set, you should be able to read the Excel file’s Table which you can connect to.
tableAppeared

Hope this quick tip helps!!

 

Create new CDS Environment and Database quickly from PowerApps Admin Center

With the April 2019 Updates, you can straight way create new D365 instances right from the PowerPlatform Admin Center.

Create New Environment

Follow these steps to create your environment from PowerPlatform Admin Center

  1. Go to https://admin.powerapps.com/environments and you’ll see an option to create New Environment.
    createNew
  2. Fill suitable details and proceed. Also, check the last section in this blog to see the difference since I chose another region than my source/original tenant when I created the D365 Trial instance (It was North America).
    specs.png
  3. You’ll see the message once this is being created.
    creating
  4. Finally, once completed, you’ll see this message where you’ll be asked if you want to proceed to creating the database as well. I recommend to create the Database as well, this will save time.
    asksToCreateDatabase

Creating Database

Considering you came here from creating the environment itself rather than choosing to create a Database to an existing environment, we’ll see how we proceed from the last Create database section.

Once you select the Create database from point #4 in the above section, you’ll see be asked to select the preferences of the database.
selectCurrency

Once you select the Currency and Language, the creation of the database will take place
creatingCDSDatabase

Once done, you’ll see that the environment and database will appear in your list.
createdENV

When you open the environment, you’ll see that for a few moments, this is being provisioned.
provisioning
Once the message goes away, you’re all set!

Instance Region

Now, note that my CDS Environment is created in the Asia Pacific (APAC) Region.
asiaRegion
And I don’t see my other regions here because the URL I’m on is port.crm5.dynamics.com

crm5URL

Whereas my original D365 Instance that got created with this trial exists on the port.crm.dynamics.com Admin Center
crmURL

 

Hope this quick post helps! 🙂

Sending Image from Canvas PowerApps to SharePoint Document Library using Flows

One of the most common requirements is to upload images to SharePoint using PowerApps. From my learning from various sources, I’ll try to “demystify” my explanation to send/upload an image to SharePoint Document Library using Flows on my Canvas PowerApp.

Ingredients

Assuming you have the following things already  in place in PowerApps as well as in SharePoint

  1. PowerApps’ Camera/Image control and a Submit button. In my case, the image above is a camera so that I capture the image I want and the image below is the Image control to show me what I clicked.
    powerApp
  2. A SharePoint Document Library to record, say, Incidents.
    spDocLibrary
  3. We will get to the Submit button on the PowerApp once we create our Flow.

Flow

Let’s create a Flow to pick the Image from your PowerApp, convert it to binary and send it to the SharePoint Document Folder location called Incidents.

  1. Since we want to trigger the Flow from the PowerApps itself, we will select the trigger of the Flow as ‘From PowerApps’ and hit Create
    createFlow
  2. Once your Flow is ready, leave the first step of PowerApps because that’s the trigger. Add Step to create a SharePoint file and fill in the details of the Document Library you have created.
    createSPFile
  3. Fill in the FileContent as above. You’ll need this to be converted in the intermediate step after this.
  4. Now, you’ll need to add an additional step in between PowerApps and the Create SP File step as below. It will be a Compose action.
    addAction
  5. In Compose action, under Expression, select dataUriToBinary expression and make sure you open the bracket as well.
    dataUriToBinary
    toolTipHidden
  6. Now, go back to the Dynamic Content section and select the CreateFile_FileContent to complete the formula.
    fileContentAvailable
    completedFormula
  7. Click OK on the screenshot above and the formula should be set.
  8. Now, replace the File Content section to take in the Output of the Compose step.
    outputRecorded
  9. Save your Flow and your complete Flow should look like this.
    CompleteFlow
  10. I’m naming my Flow as ‘IncidentFlow’ so that I can identify it.
    incidentFlow

Adding the Flow to Submit button

Going back to the PowerApp, let’s Run this Flow on the selection of the Submit button and pass the image.

  1. Now, select the Submit button, and on the Formula bar, add the Flow you created, I named it IncidentRun. Select the same so that the Formula comes as IncidentRun.Run( for you to pass on the image.
    Now, pass the latest image on the collection i.e. the same image which is being displayed in the image control below.

    runFlowFormula

 

Running the App

I just ran the app on the desktop itself, you could do it from your phone too!
So I clicked on the Camera when I was ready, the image appeared in the image control and I that was what I wanted to upload. So I clicked on Submit button.
hittingSubmit

The flow was successful
FlowSuccessful

And my image was in SharePoint too!
imageUploaded

I know it is a lengthy post but I tried to summarize as much as possible. Make sure you have a way to uniquely name each file or else, the same file will be overridden.

Thank you!

 

Create your first PowerApp! Connect to SharePoint Online List

PowerPlatform is the next big thing in

PowerApps comes with several Dynamics 365 licenses and make sure you have been assigned one as well as below –
license

Navigate to https://web.powerapps.com/ to go to the Admin Center and here you can simply start working on your first app.

In this scenario, I want to be able to read from my SharePoint Online list and make decisions based on what data is in the List
spList

Build your PowerApp from data

  1. Among the options to create your app from either Canvas or Model-driven, I’ll chose to build one based on data which is a Canvas type of application.
    startFromData
  2. Now, I’ll chose SharePoint’s Phone layout since I want to connect to my SharePoint Online site to be able to read from my lists
    selectSPApp
  3. Now, since I already have selected SharePoint connector, I’ll be creating a new connection on the next page.
    createSPConnection
    Since this example is for SharePoint Online, I’ll select Connect directly (cloud services).
  4. Now, since I already had accessed the SharePoint Site, it appears in my list. You can either connect to a new Site from + New Connection button on the left-hand side or enter a new SharePoint Site in the URL and click GO. Or even select a recently visited one like I did –
    selectSPSiteFromRecent
  5. Then, choose your list
    chooseList
  6. And it takes a few moments to build out your App. And when it’s ready to be worked on, here’s what you get.
    appIsReady

Understanding your App Designer space

Won’t be covering much details on what each tool does, but wanted to share how things are placed –

  1. On the left-hand side, the App pages/components are divided into three main sections. (Obviously, you are free to add and modify more screens as needed)
    defaultTreeView
  2. You can add several controls on these screens
    insertTab
  3. And these controls/components can be adjusted from the right-hand side pane as below
    customizeProperties
  4. That’s basically the most of the App basics you need to know at this point. I’ll post more posts on that later. 🙂

Publishing Your App & Share

Presuming that your app is now ready to go, her’s what you can do in order to publish

  1. Navigate to File, give a suitable Name to your App.
    appName
  2. Move over to Save and Save your App.
    saveApp
  3. Once Saved, Share the App.
    shareThisApp
  4. Once you click on Share, you can get to Add users who will have access to this App and you can chose their permission level.
    shareWithUser
    permissionSelection

Running your first PowerApp

Assuming you have installed PowerApps on your device and logged in with your credentials, you’ll see the App as below

And you can start working on your App already

Hope this was quick. And then there’s a tremendous lot to be done with PowerApps and leveraging the PowerPlatform!