Double quote in string javascript

I need to use double quotes within my js. After compiler errors, looked through forum posts here and solution was to use three double quotes

original script

function checkStatus(){
if(document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::queue"]').length == 0 && 
	document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::in-progress"]').length == 0 && 
	document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::queued"]').length == 0) 
return 1;
else return 0;
}

Now adding the additional double quotes that inject javascript activity needs

"function checkStatus(){
if(document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::queue"]').length == 0 && 
	document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::in-progress"]').length == 0 && 
	document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::queued"]').length == 0) 
return 1;
else return 0;
}"

but this escapes the double quotes. So replaced these with three per forum posts

"function checkStatus(){
if(document.querySelectorAll('[validationid="""controller:learner-transcript-details:::svg:::queue"""]').length == 0 && 
	document.querySelectorAll('[validationid="""controller:learner-transcript-details:::svg:::in-progress"""]').length == 0 && 
	document.querySelectorAll('[validationid="""controller:learner-transcript-details:::svg:::queued"""]').length == 0) 
return 1;
else return 0;
}"

Compiler error. Also tried with two double quotes but same issue

"function checkStatus(){
if(document.querySelectorAll('[validationid=""controller:learner-transcript-details:::svg:::queue""]').length == 0 && 
	document.querySelectorAll('[validationid=""controller:learner-transcript-details:::svg:::in-progress""]').length == 0 && 
	document.querySelectorAll('[validationid=""controller:learner-transcript-details:::svg:::queued""]').length == 0) 
return 1;
else return 0;
}"

x_x

change it to following

"function checkStatus(){ " & 
" if(document.querySelectorAll('[validationid="controller:learner-transcript-details:::svg:::queue"]').length == 0 " + 

we close each line with " and concat next line with & or + (& is preferred)
next line we start with "

etc.

as anlternalet we can use an invoke code, set to C# language and can use the @ before to tell thet the string should be handle literally / unescaped

thank you!

actually this still didnt work bc the quotes escaped it again. we moved it to a file and call it written normally as .js

i still dont understand why it’s not working with “”"

it’s a long process to get to this screen and since the call of the .js file works, i am going to abandon this. im not sure if someone mod wants to delete topic as there wont be a confirmed solution

@nyra.y.ruiz


Message Box just did some breaks as there was space on the length was available


Quotes within the text we used double quotes
line start and end as described above

Hi @nyra.y.ruiz

Save your js file as text file

Read that text file by using read text file activity

Pass the output variable of read text file activity into inject js activity

Thanks
Robin