Hello and thanks in advance.
I'm setting up a flow that sends an email. In that email, I need to format the time better than what it comes out today as:
I was able to successfully get this to work before but trying the same expression (formatDateTime(triggerOutputs()?['body/hc_startdate'], 'MM/dd/yyyy')) and still getting an error:
Is my syntax incorrect?
Solved! Go to Solution.
Hi @Shap1
You will need to check if the incoming hc_billratechangeeffectivedate is Null or 'No' or if empty is 'True'.
Add conditional statements and turn the flow accordingly.
Do the same for both the dates.
At first do a simple compose action for empty(triggerOutputs()?['body/hc_billratechangeeffectivedate'])
See what the output is when the input is 'No'.
Maybe it is False. In that case compare it with using 'bool' (shown in below links).
Using expressions may become complex, so check out the options in the below links whether you want to use Expressions or If Conditional action.
https://www.dynamics365crm.org/post/check-if-a-field-date-is-blank-in-microsoft-automate
-------------------------------------------
Help fellow beings find relevant posts.
Upvote to a supporting response.
Mark as solution to an answer.
@Shap1 can you check if the value of triggerOutputs()?['body/hc_startdate'] is no value or blank? from error it looks like there is no value for hc_startdate
Hi @Ann- Thanks for your reply.
I put in the existing normal field and it populates. I'm just trying to convert that to a better date field using an expression. It looks like my expression is not working even though hc_startdate by itself works.
@Shap1 can you add compose action with this expression triggerOutputs()?['body/hc_startdate'] just to see if it has value or not
Hello @Shap1
Could you please share your formatDateTime expression.
And as requested by Anna check out the Compose action.
Thanks guys. Here's is my compose:
Also, this is my expression:
formatDateTime(triggerOutputs()?['body/hc_startdate'], 'MM/dd/yyyy')
.
Thanks @nc1.
I tried as you suggested: replace(formatDateTime(triggerOutputs()?['body/hc_startdate'],'MM-dd-yyyy'),'-','/')
This did not work and came back as the following:
"The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'."
Hi @Shap1
It doesn't seem to be right that the Compose statement is not printing the actual value of the hc_startdate.
Can you double check why? Is there a value in it? Have you selected it correctly from the Dynamic content.
If that is blank then the error is right about the Null value.
It is something with your current date/time variable. I would cast it as a string to be sure it's the correct format and then ensure that you are selecting the correct dynamic content.
I misread prior to my first comment oops.
nc
Edit:
https://powerusers.microsoft.com/t5/Building-Flows/Flow-failing-due-to-Null-value/td-p/55527
take a peek at this solution, it may be of help.
@Shap1 you need to put the expression in the Dynamic content -> Expressions, not as a text in compose action. Can you please try putting expression via Dynamic content -> Expressions? and see the value of compose action in flow run?
Hi @VJR, @annajhaveri, @nc1, @abm
This expression worked when the date fields are populated:
(from email)
HOWEVER,
it does not work and I get an ERROR if the date fields are set to no and do not need to be populated:
Error:
How can I do it incase it does happen where they do not need to enter in any dates?
Hi @Shap1
You will need to check if the incoming hc_billratechangeeffectivedate is Null or 'No' or if empty is 'True'.
Add conditional statements and turn the flow accordingly.
Do the same for both the dates.
At first do a simple compose action for empty(triggerOutputs()?['body/hc_billratechangeeffectivedate'])
See what the output is when the input is 'No'.
Maybe it is False. In that case compare it with using 'bool' (shown in below links).
Using expressions may become complex, so check out the options in the below links whether you want to use Expressions or If Conditional action.
https://www.dynamics365crm.org/post/check-if-a-field-date-is-blank-in-microsoft-automate
-------------------------------------------
Help fellow beings find relevant posts.
Upvote to a supporting response.
Mark as solution to an answer.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Did you know that you could restore a deleted flow? Check out this helpful article.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
23 | |
13 | |
11 | |
10 | |
8 |
User | Count |
---|---|
32 | |
25 | |
24 | |
17 | |
16 |