cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Poseidon10
Helper I
Helper I

Unable to process template language expressions in 'formatDateTime' issue

I have a flow that has several dates.  I am 99% sure my formatDateTime expressions are correct for the flows however I am still getting the "InvalidTemplate. Unable to process template language expressions in action 'Updates_Completed_by_Contracts_2' 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.'." error.  

 

Here are all of my date expressions, please let me know if you see anything wrong:

 

formatDateTime(triggerBody()?['RiskStartDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['RiskEndDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['PreviousRiskStartDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['PreviousRiskEndDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['EstPoPStart'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['EstPoPEnd'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['CommsDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['FundingRequestDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['DateModExpected'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['Field8'],'MM/dd/yyyy')

 

If these are all correct, what could be another reason for error?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Poseidon10 ,

 

Please try:

 

if(empty(triggerBody()?['RiskStartDate']),null,formatDateTime(triggerBody()?['RiskStartDate'],'MM/dd/yyyy'))

if(empty(triggerBody()?['RiskEndDate']),null,formatDateTime(triggerBody()?['RiskEndDate'],'MM/dd/yyyy'))

……

 

Best Regards,

Bof

View solution in original post

9 REPLIES 9
JeffGimo
Resolver II
Resolver II

One of the Fields you have return you a null value.

You can show me the error or data then I'll pinpoint what caused the issue.

@JeffGimo , Which error are you referring to?  See screenshot

Poseidon10_1-1656620604662.png

 

 

 

better quality screenshot

Poseidon10_2-1656620709497.png

 

Show me the data itself. The raw data for these ones. The output before the Condition.

I also noticed that the last part field name is Field8 

formatDateTime(triggerBody()?['RiskStartDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['RiskEndDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['PreviousRiskStartDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['PreviousRiskEndDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['EstPoPStart'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['EstPoPEnd'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['CommsDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['FundingRequestDate'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['DateModExpected'],'MM/dd/yyyy')
formatDateTime(triggerBody()?['Field8'],'MM/dd/yyyy')

 

@JeffGimo , I am not sure what you mean for "raw data for these ones. The output before the condition".  Before the condition I just have some variables, I checked the output for those and everything looks fine.  Which step do you want to see the raw output for?

For Field8, that is to correct name for the field.

Poseidon10_0-1656624774344.png

 

 

JeffGimo
Resolver II
Resolver II

The raw data from sharepoint. Or the value you used for apply to each 2. 

@JeffGimo , below is the output of the variables.  They are just variables for some dropdown values I have, to make the email easier.  They did not return null values so I don't think they are the problem.

Poseidon10_0-1656676642504.png

 

JeffGimo
Resolver II
Resolver II

I meant this

RiskStartDate
RiskEndDate
PreviousRiskStartDate
PreviousRiskEndDate
EstPoPStart
EstPoPEnd
CommsDate
FundingRequestDate
DateModExpected
Field8
v-bofeng-msft
Community Support
Community Support

Hi @Poseidon10 ,

 

Please try:

 

if(empty(triggerBody()?['RiskStartDate']),null,formatDateTime(triggerBody()?['RiskStartDate'],'MM/dd/yyyy'))

if(empty(triggerBody()?['RiskEndDate']),null,formatDateTime(triggerBody()?['RiskEndDate'],'MM/dd/yyyy'))

……

 

Best Regards,

Bof

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,207)