cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vikesh
Level: Power Up

NULL error using ticks on a date with a value from Dynamics 365

Hello,

 

I'm receiving an error using the ticks function trying to parse a date being returned from a Dynamics 365 record.

I'm trying to update a value in a CRM record using the following expression: 

ticks(triggerBody()?['xx_dateofbirthdateonly'])
 
When testing the flow the following error is received:
InvalidTemplate. Unable to process template language expressions in action 'Update_a_record' inputs at line '1' and column '2633': 'The template language function 'ticks' expects its parameter to be a string that represents a timestamp. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#ticks for usage details.'.
 
In the body of the retrieve call among other values I can see the following value in the relevant field:
"xx_dateofbirthdateonly": "2019-07-26",
 
Any ideas why the date is not being picked up?
 
I've tried this with both date and date/time values.
I've also changed the behaviour of the date field within CRM between "User Local" and "Date Only"
 
Any help appreciated.
 
Thanks,

Vikesh
1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: NULL error using ticks on a date with a value from Dynamics 365

Hi @Vikesh 

 

I see that you are using the recurrence as a trigger and in the formula you put triggerbody and this is where the issue is. The triggerbody here will only have details (if any) from the recurrence and not the dynamics action. You can simply select the date time value from the dynamic selector while using the expression. 

 

And if it is not working that way, use the expression like this: 

 

ticks(items('Apply_to_each')?['xx_dateofbirthdateonly'])

 

instead of the 

 

ticks(triggerBody()?['xx_dateofbirthdateonly'])

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: NULL error using ticks on a date with a value from Dynamics 365

Hi @Vikesh 

 

Can you please share a screenshot of the entire flow? Also, what trigger are you using in your flow? 

 

I am also trying to understand the use of the ticks function in your flow. If you could share these details, we might better identify the issue and assist you with this. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Vikesh
Level: Power Up

Re: NULL error using ticks on a date with a value from Dynamics 365

@yashag2255 

 

Flow.png

 

The flow is being used to calculate the Age of a person from their DOB.

 

The flow is scheduled to run once a day.

 

The list records action is retrieving one record at the moment as intended.

 

I'm using the following expression to calculate the age:

 

int(split(string(div(div(sub(ticks(utcNow()),ticks(triggerBody()?['xx_dateofbirthdateonly'])),864000000000),365.25)),'.')[0])

 

The expression ticks(utcNow()) returns a value as expected.

 

It's just the expresion ticks(triggerBody()?['xx_dateofbirthdateonly']) that is returning an error when trying to return a value.

 

EDIT

Within the update record action only the following fileds are filled:

Organization Name: Orgname

Entity Name: Contacts

Record Identifier: Current Item

Age in Years: ticks(triggerBody()?['birthdate'])

 

Any idea?

 

Thanks,

 

Vikesh

Dual Super User
Dual Super User

Re: NULL error using ticks on a date with a value from Dynamics 365

Hi @Vikesh 

 

I see that you are using the recurrence as a trigger and in the formula you put triggerbody and this is where the issue is. The triggerbody here will only have details (if any) from the recurrence and not the dynamics action. You can simply select the date time value from the dynamic selector while using the expression. 

 

And if it is not working that way, use the expression like this: 

 

ticks(items('Apply_to_each')?['xx_dateofbirthdateonly'])

 

instead of the 

 

ticks(triggerBody()?['xx_dateofbirthdateonly'])

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Vikesh
Level: Power Up

Re: NULL error using ticks on a date with a value from Dynamics 365

@yashag2255 

Thanks for your help!

 

That has solved the problem, I'm still new to flow, figuring it out! 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,775)