Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

workflow javascript code component

nidhiv77838491
Level 3
Level 3

Hi Team,

Can you please let me know how should i replace <%= new Date().getFullYear() %>. Correct script is <%= "<" + "%= new Date().getFullYear() %" + ">" %> in javascript code workflow.

Regards,

Nidhi

1 Accepted Solution
naveens49375819
Correct answer by
Level 2
Level 2

Hi Nidhi,

I am not sure what is your requirement.

If you are calling any js functions within js activity. You can call as like below.

var test = new Date().getFullYear() ;

logInfo(test)

This will show you current year.

Thanks

Naveen S

View solution in original post

3 Replies
nidhiv77838491
Level 3
Level 3

how to give -  <%= "<" + "%= new Date().getFullYear() %" + ">" %> in a variable in javascript file in workflow .

Please guide me on the same showing error as while parsing XML string when providing as below syntax - vars.searchString='&lt;%= new Date().getFullYear() %>'; in order to replace -  <%= new Date().getFullYear() %>. Correct script is <%= "<" + "%= new Date().getFullYear() %" + ">" %>

Thanks Much in Advance!

Regards,

Nidhi

naveens49375819
Correct answer by
Level 2
Level 2

Hi Nidhi,

I am not sure what is your requirement.

If you are calling any js functions within js activity. You can call as like below.

var test = new Date().getFullYear() ;

logInfo(test)

This will show you current year.

Thanks

Naveen S

View solution in original post

Amit_Kumar
Community Advisor
Community Advisor

Hi Nidhi,

it's not clear from the question can you please share the screenshot to support what you want?

Regards,

Amit