Skip to content
JScheper.com
JScheper.com

BizApps, Powerplatform and AI

  • Home
  • Blog
  • Contact
JScheper.com

BizApps, Powerplatform and AI

Adding Goals in bulk

Adding Goals in bulk, simple and easy!

Posted on November 14, 2025November 14, 2025 By Jeroen Scheper

In my previous blog post, I wrote about goal management in general (link to article here). The post explains how goal management works and how to configure it yourself. Adding goals in bulk is one of the gaps I noticed while I was looking into this feature. Yes, there is always the option to go for the Excel route, of course, but in this post, I would like to demonstrate how you can build something yourself so adding goals in bulk will be simple and easy.

From a functional or process perspective, you need to decide what the philosophy is. In my use case for Padel Vamos, I would like to create the goals for an owner, for certain goal metrics, and for the remaining months of the current year.

Technically, this means that I need to create the following:

  • a new Button on the goal management form
  • a Custom page that is collecting the required information
  • a Power Automate Flow to process all of this

Add Goals Bulk button

First, you need to make sure that you create a new custom button that will eventually launch the custom page. Follow the next steps to do this:

  • Navigate to https://make.powerapps.com/
  • Edit the Model-Driven App where you want to add this button to
  • Add or find the Goals view and select the three dots > Edit command bar > Edit
  • Select Main Grid and press Edit
  • Add a button via + New > Command
  • Set the following properties:
    • Icon = either a standard or upload one yourself
    • Action =Run JavaScript
    • Library = I have built a custom library with functions to open dialogs
    • Function = openCustomPageDialog

      I will not go into too much detail on this. The JavaScript code is below, where I believe the most important bit is the name of your custom page: jsc_goalbulkadding_74275. If you are interested in this topic, then there are great people in the community who have written in detail about this, like Matthew Devaney, so check out his post about that here, since he explains it really well.
function openCustomPageDialog(primaryControl, firstSelectedItemId, selectedEntityTypeName)
{
    // Centered Dialog
    var pageInput = {
        pageType: "custom",
        name: "jsc_goalbulkadding_74275",
        entityName: selectedEntityTypeName, 
        recordId: firstSelectedItemId 
    };
    var navigationOptions = {
        target: 2,
        position: 1,
	height: {
	    value: 500,
	    unit: "px"
	},
	width: {
	    value: 50,
	    unit: "%"
	},
	title: "Goal Management - Bulk Add Goals"
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function () {
            // Refresh the main form when the dialog is closed
            primaryControl.data.refresh();
        }
    ).catch (
        function (error) {
            // Handle error
        }
    );
}

Custom page: Adding goals in Bulk

When it comes to the custom pages, I would like to share again that there are great people in the community who can share a lot more about the best practices, for example, Megan Walker, who is now writing a whole series on this topic, so check it out here if you are interested in this topic.

For the creation of goals, there are a few key things that are needed, but also some decisions to make on how this can work for you:

  • Goal Owner: to whom will this goal apply
  • Goal Metric, so for which metric do I want to add the goals in bulk
  • What is the Target
  • The one that is not on this list, but was the most difficult one was the Goal Period.
    Standard, probably the easiest one is the Quarterly periods. In my example, I want to go for the custom route and do this per month 😅😁

The cosmetic changes I will not explain in detail in this post, since the most important one to explain is the OnSelect of the Save button. In this statement, we trigger the Power Automate Flow with the Guids and values of the custom page.

Power Automate Flow, where the magic happens

This is the bit of adding goals in bulk that I do like to focus on. Most of the time of this feature is spent here.

Additional information per step:
Initialize variable – Current month:

int(formatDateTime(utcNow(), 'MM'))

Initialize variable – Current Year:

int(formatDateTime(utcNow(), 'yyyy'))

Initialize variable – Last Day of Month:

subtractFromTime(startOfMonth(addToTime(utcNow(),1,'month')),1,'day','dd')

Add Goal
Name is a concatenation of Owner, Metric, Year, and Month

concat(items('For_each')?['fullname'], ' - ', outputs('Get_Goal_Metrics_by_GUID')?['body/name'], ' - ',variables('VarCurrentYear') ,'-',variables('varCurrentMonth'))

From is the first day of Month

formatDateTime(concat(utcNow('yyyy-'), variables('varCurrentMonth'), '-01'), 'yyyy-MM-dd')

To is the last day of Month

formatDateTime(concat(utcNow('yyyy-'), variables('varCurrentMonth'),'-', variables('LastDayOfMonth')), 'yyyy-MM-dd')

Set variable – Set Last Day of Next Month

The last day of the next month is being calculated from today’s date, which means varNumberOfMonths is crucial to have in order to calculate the right last date of the month

subtractFromTime(startOfMonth(addToTime(utcNow(),variables('VarNumberOfMonths'),'month')),1,'day','dd')

Overall, this was a fun experience to build, and if you have resolved this differently or have different thoughts about this, then feel free to share something in the comments.

My next post will also be on the topic of Goal Management and another gap I experienced, which will even be more fun.

Sales Customer Insights Field Services Power Apps Power Automate Power Platform Reporting Add goals in bulkbulk goalsgoal managementperformance management

Post navigation

Previous post

Related Posts

Model-driven Apps Sublime way of collaborating

Sublime way of collaborating on a record in model-driven apps

Posted on July 2, 2024July 17, 2024

Sometimes you come across something that you think “Ah that is kind of cool”. I had such a moment this week where I came across something around collaboration on a record within a model-driven app. It is already there for a couple of months based on what I can see,…

Read More
Power Platform Setting up maintenance window

Less frustrations by setting up a maintenance window

Posted on June 4, 2025June 2, 2025

Have you ever faced the issue that you have planned to do a deployment, but by the time you are ready to import your solution, you find out Microsoft is doing an update? Setting up a maintenance window will help reduce these frustrations. When you have selected your solution file…

Read More
AI Builder

AI Model crushed the game against Austria

Posted on June 24, 2024July 17, 2024

Tomorrow is already the last match of the group stage against Austria. Who will make it to the next round is the big question of course. It will be exciting to see who is making it to the next round. As always first a couple of interesting facts about the…

Read More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

ABOUT ME

  • LinkedIn
  • Mail
  • GitHub
  • YouTube
"BizApps and PowerPlatform dude with a passion for AI, sitting relaxt in his black shirt on a bounty white beach with palm trees, a azure blue ocean in the background and enjoying a good coffee "

~GenAI - DALL.E 3 and GPT 3.5

Subscribe

Please wait...

Thank you for subscribing!

Search

Categories

  • AI Builder
  • AI Prompting
  • Artificial Intelligence
  • Copilot
  • Customer Insights
  • Customer Service
  • Dataverse
  • Field Services
  • Generative AI
  • Model-driven Apps
  • Personal Development
  • Power Apps
  • Power Automate
  • Power BI
  • Power Platform
  • Reporting
  • Sales
  • SharePoint

Archive

  • November 2025
  • October 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
© 2024 - All rights reserved | Jeroen Scheper | Privacy Policy