Using embedded data (date) in display logic | XM Community
Skip to main content
I've got a survey that collects the current date in the survey flow. I'd like to use that date in display logic for certain questions so that one of them only shows up in the month of May and another one of them does not show up in May, June, July, or August. Is this even possible? I can't find a way to parse out the month from the embedded date field.
Hello @VirginiaM



Follow this post to get current month in embedded data and then use it in display logic of the question.
Thanks @Shashi --I copied and pasted the javascript but I'm getting an alert. I think something must be missing but I don't know enough javascript to tell what it is. Any thoughts?

!
> @VirginiaM said:

> Thanks @Shashi --I copied and pasted the javascript but I'm getting an alert. I think something must be missing but I don't know enough javascript to tell what it is. Any thoughts?

> !

>



Thanks for posting the issue. I have updated the code in that post



The error is on "var n=...." line, the correct code is `var n=monthNames[d.getMonth()]; `
That took care of the alert @Shashi! Is this written in such a way that it will automatically populate with the current date (month)? I have current date as an embedded data field as well.
> @VirginiaM said:

> That took care of the alert @Shashi! Is this written in such a way that it will automatically populate with the current date (month)? I have current date as an embedded data field as well.



Yes, no need of current date. the above code will give the current date (month)

Leave a Reply