Posts

Patching SharePoint Choice columns from PowerApps using 'Value'

  Copilot Prompt How do I patch a SharePoint choice column using a String in PowerApps? A quick PowerApps tutorial today. This is something that seems like it should be quite simple, but trips a lot of people up. It seems logical that you should just be able to patch the choice column with whatever string matches the choice your trying to select. For example: Patch( YourList, Defaults(YourList), { YourChoice: "Choice 1" } ) However a choice needs you to patch a record, stating the ‘Value’, instead of just a string: Patch( YourList, Defaults(YourList), { YourChoice: {Value: "Choice 1"} } ) If you’re using a dropdown or combo box within your app, you can reference it directly: Patch( YourList, Defaults(YourList), { YourChoice: Dropdown_choice.Selected } )

Automatically populating the Git user.name and user.email when committing via Azure DevOps Pipelines

I was reviewing my teams Azure DevOps pipeline setup, and noticed that each pipeline has its commit hardcoded to whichever Developer created it. This is one of those things that’s probably dead obvious if you work with Azure DevOps every day. But for me as an occasional user working with classic pipelines it took time to work out. Microsoft’s recommended method of having an Export/Commit pipeline for Power Platform projects ends with a commit step. An inline PowerShell script commits your exported and unpacked Solution to the repository. To make the commit message use the details of whichever User runs the pipeline, do the following: git config user.email " $(Build.RequestedForEmail) " git config user.name " $(Build.RequestedFor) " The expressions between $() are variables native to ADO. wrapping these in quotes passes a string representation of the User information to the Git message. This commits as whoever runs the pipeline.

Merging collections in a Canvas app using Patch

On a recent project, I was getting frustrated at having to change the same Patch code many times. Don’t repeat yourself (DRY) is tricky to implement in PowerApps. What follows is the solution I came up with to simplify it. The app needed to create records of several different types, but with a set of common fields. At first I had a large switch statement, with a Patch for every record type, core fields included. This led to a Patch statement of around 1000 lines. Yes. I found I could create one collection with the common core fields. I could then build a second collection with the differing fields using a Switch formula. Once I had the two collections I could merge them together into a 3rd collection using Patch(): Patch(collectionMerged, collection1, collection2); I then Patched the the first record of this collection to the Datasource: Patch(DataSource, Defaults(DataSource),First(collectionMerged)) I couldn’t get it working with a record. This made my formula a lot more readable. It ...

Clear an Array in Power Automate

Image
Quick one today. Sometimes you may need to empty/clear an array of values in Power Automate. Simple solution to this is to pass the  null  expression to the array in a set. Initialise your variable Set the variable to null Variable is cleared 

Base64 Encoding Images in PowerShell

I needed to embed a couple of additional images into a HTML file. The output file already had a couple of base64 encoded SVGs within it, so I decided to try doing the same with the additional images. Instead of using an online encoding service I tried to find if I could do it in PowerShell. I found the following solution. [ Convert ]::ToBase64String((Get-Content -Path .\myImage.png -Encoding Byte)) >> myImage.txt Explainer [Convert]::ToBase64String  calls the ToBase64String method of the .NET Conversion class. Essentially using a .NET library to do the lifting. I then pass PowerShells Get-Content cmdlet as an argument with the path to the image. >>  simply redirects the output of the Convert method to a text file. I can then paste the output of the text file into the HTML  <img>  tag.

Book Review - Get Everything Done and Still Have Time to Play

  Below is my book review/summary of   Get Everything Done and Still Have Time to Play   by Mark Forester The book in 3 sentences The ‘word’ no is the fundamental time management tool, you can’t do more if you’re doing too much. Time management is about overcoming resistance and focusing our attention We need to build into our lives time to think, time to reflect Impressions I’ve read a lot of productivity books but this one really got me thinking and focusing on how much I fit into my life. Especially now I’m a parent, I have even less time than before. I was surprised when I did the commitments inventory how little time I do have. I couldn’t fit any more activities into my life than I already do and still give them the attention they deserve. Even then I’m not giving some activities the attention they do deserve in the first place! I also tried his technique of rotating between activities in brief time bursts to get past the resistance and get things moving. This allowe...