Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4kToZ07p5ube0q8ecadqvz
Power Automate - Building Flows
Unanswered

Variable Initializing creates error stating Null value being pulled instead of String

Like (0) ShareShare
ReportReport
Posted on 22 Jan 2025 14:52:43 by 2
To begin, is linked to two different SPO Lists. The flow is triggered by "When item is created" in the SPO List.
 
SPO List 1 is a log book that in one column, I am using this flow to give a ticket number to the item in that row that has a unique identifier built by the flow and I do not want to use the ID column, because I am working towards the flow resetting itself at the start of a new month, the unique identifier should build the number in this format: ABC-YYMM-xxxx, ABC being the location code, YYMM being the two digit year and two digit month, and xxxx being an integer from 0001 all the way to 9999, but mostly never going past 0300.
 
SPO List2 has one item in there and this is the next value to be used for the Log book in SPO List 1. Before the flow runs, the number will be the one for the Logbook entry that triggers the flow. And by the end of the flow, the number will be incremented by 1 and will be the next logbook entry. The part of the flow that is working is the triggering and pulling in the item from SPO List 1 and SPO List 2, and it creates the ID and then increments the number in SPO List 2. 
 

 
What is giving me issues is that I am attempting to determine if the new SPO List 1 item is the first item created in a new month, and then I want the value in SPO List 2 to be reset back to 1. So as of right now I have the following steps:
- "When an item is created" trigger for the value in SPO List 1. 
- "Get item form Ticket Log" to pull the ID for the created item in SPO List 1.
- "Get items from Increment" to pull the items (which is just one thing) from SPO List 2.
- And then here is where it gets hairy: 
I have steps to Initialize two different variables. The variables are 
 

The formula here is formatDateTime(outputs('Get_items_from_Increment')?['body/Modified'], 'MM')
 

The formula here is formatDateTime(outputs('Get_item_from_Ticket_Log')?['body/Created'], 'MM')
 
 
The error that I get when I create an item in SPO List 1 yields this:
 
Action 'Initialize_variable_-_Increment' failed: Unable to process template language expressions in action 'Initialize_variable_-_Increment' inputs at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
 
 
But when I look at the outputs from the "Get items from Increment", the 'Modified' output was appropriately "Modified": "2025-01-21T22:18:42Z"
And when I look at the outputs from the "Get item from Ticket Log", the 'Created' output was appropriately "Modified": "2025-01-22T14:21:20Z"
So the outputs look right and like they should work but seem to be pulling in a Null value in the first "Initialize Variable" step.
The Code View here includes

 
 
Am I doing the wrong step? I even tried to put the expressions in my condition and not initializing a variable, and got the same error. The condition is comparing MM from the created item to the modified MM of the increment item. If they are not equal, then the false step should Update Item in the Increment Log to 0.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,606 Most Valuable Professional

Leaderboard
Loading started