Hack #5: Use create a Project action in Flow the easy way in Dynamics 365 Project Operations!

Power Automate is amazing but sometimes our relationship gets tough. One is with the action Add a New Row.

In this example, my trigger is manual (just testing), but it could be anything really (a project approval that went through or something else). After my trigger, I wish to create a new project!

Now the table ‘Projects’ or msdyn_projects has 125 fields of which 11 are mandatory:

In order to create a new project, you MUST give each of these fields a value. And that’s where the issue begins. How can I give this action a Contract Line for instance, if I am only creating a project and I don’t have a value/need for that? For an internal project, and I don’t need one!

Now, let’s assume, after two days of hard work and magic, you find values to include here, and your flow can be saved and run. You think your job is done and move on!

* Red asterisk means death mandatory fields!

Then, you deploy it in another environment, take it for a spin, and it fails with this message: Object reference not set to an instance of an object. Translated to English it means you have a null/data validation error in your hands.

The solution

The solution is so simple that it makes you cry with happiness. Instead of using ‘Add a new row’ you use ‘Update a row’:

What happens is that this action just needs a ‘row ID’, and all other fields are ‘not mandatory’ to run it.

Select the action Update a row, in the field Row ID you will write this expression GUID() and hit OK as below:

After hitting ok it looks like this. No more sea of reds:
Now, understand that the ‘Update a row’ action can do two things:
One is to update a record (duh!),
and second, if there is no record with that row ID create a new one.
So, in our case what we did by assigning the expression GUID() is that we tell the action to create one from scratch every time since we are giving the expression and not a row ID. So, instead of ‘updating’ we are ‘adding’ a new row by using the expression. Marriage made in Heaven!

Note that I can and should plug values inside any of the fields in this action (mandatory or not). Now, if let blank, it will pre-populate the table from the assigned PM’s information (Organizational Unit, Currency, Schedule Mode, Project Calendar, and more), so make sure your PM in the project has roles, organizational units, and other elements so you don’t run into problems here. A basic setup is needed.

Example of fields that prepopulate from the PM’s setup. The Project Manager/record owner.

And it even bypasses the mandatory name field (obviously, we don’t want to use it this way so make sure you populate the needed fields for your scenario):

I hope this helps and please subscribe or comment.

Microsoft official documentation:

Docs: https://learn.microsoft.com/en-us/dynamics365/project-operations/

Project interface: https://learn.microsoft.com/en-us/dynamics365/project-operations/project-management/navigate-ui

Thank you and see you next time with more Dynamics 365 Project Operations tricks!

2 thoughts on “Hack #5: Use create a Project action in Flow the easy way in Dynamics 365 Project Operations!

Comments are closed.