Find and Replace text at Variables

Hello guys.

I have a course that is full of variables. After the student fill everything, that send the info to one sheet at google drive.

So far, all good.

But I have to find and replace any line break at the variables, I tried everything that I could find in the community but everything made my code stop.

Any idea? Here's the javascript that works:

var player = GetPlayer(); 

$.ajax({

url:
"https://script.google.com/macros/s/AKfycbx-YOzsZpscDxF3LZuj8IOsZx0DK1TZaPujrrhRROF6yN9JUWk/exec",

type: "POST",


data: {"Funcionario": player.GetVar("Funcionario"),"Produtor": player.GetVar("Produtor"),"Responsavel": player.GetVar("Responsavel"),"PqMercado": player.GetVar("PqMercado"),"CS1": player.GetVar("CS1"),"CS2": player.GetVar("CS2"),"CS3": player.GetVar("CS3"),"CS4": player.GetVar("CS4"),"CS5": player.GetVar("CS5"),"CS6": player.GetVar("CS6"),"Acoes1": player.GetVar("Acoes1"),"Acoes2": player.GetVar("Acoes2"),"Acoes3": player.GetVar("Acoes3"),"Acoes4": player.GetVar("Acoes4"),"Acoes5": player.GetVar("Acoes5"),"Acoes6": player.GetVar("Acoes6"),"Acoes7": player.GetVar("Acoes7"),"Acoes8": player.GetVar("Acoes8"),"Acoes9": player.GetVar("Acoes9"),"Acoes10": player.GetVar("Acoes10"),"Acoes11": player.GetVar("Acoes11"),"Acoes12": player.GetVar("Acoes12"),"Acoes13": player.GetVar("Acoes13"),"Acoes14": player.GetVar("Acoes14"),"Acoes15": player.GetVar("Acoes15"),"Pq1": player.GetVar("Pq1"),"Pq2": player.GetVar("Pq2"),"Pq3": player.GetVar("Pq3"),"Pq4": player.GetVar("Pq4"),"Pq5": player.GetVar("Pq5"),"Pq6": player.GetVar("Pq6"),"Pq7": player.GetVar("Pq7"),"Pq8": player.GetVar("Pq8"),"Pq9": player.GetVar("Pq9"),"Pq10": player.GetVar("Pq10"),"Pq11": player.GetVar("Pq11"),"Pq12": player.GetVar("Pq12"),"Pq13": player.GetVar("Pq13"),"Pq14": player.GetVar("Pq14"),"Pq15": player.GetVar("Pq15"),"Quem1": player.GetVar("Quem1"),"Quem2": player.GetVar("Quem2"),"Quem3": player.GetVar("Quem3"),"Quem4": player.GetVar("Quem4"),"Quem5": player.GetVar("Quem5"),"Quem6": player.GetVar("Quem6"),"Quem7": player.GetVar("Quem7"),"Quem8": player.GetVar("Quem8"),"Quem9": player.GetVar("Quem9"),"Quem10": player.GetVar("Quem10"),"Quem11": player.GetVar("Quem11"),"Quem12": player.GetVar("Quem12"),"Quem13": player.GetVar("Quem13"),"Quem14": player.GetVar("Quem14"),"Quem15": player.GetVar("Quem15"),"EnvolverQm1": player.GetVar("EnvolverQm1"),"EnvolverQm2": player.GetVar("EnvolverQm2"),"EnvolverQm3": player.GetVar("EnvolverQm3"),"EnvolverQm4": player.GetVar("EnvolverQm4"),"EnvolverQm5": player.GetVar("EnvolverQm5"),"EnvolverQm6": player.GetVar("EnvolverQm6"),"EnvolverQm7": player.GetVar("EnvolverQm7"),"EnvolverQm8": player.GetVar("EnvolverQm8"),"EnvolverQm9": player.GetVar("EnvolverQm9"),"EnvolverQm10": player.GetVar("EnvolverQm10"),"EnvolverQm11": player.GetVar("EnvolverQm11"),"EnvolverQm12": player.GetVar("EnvolverQm12"),"EnvolverQm13": player.GetVar("EnvolverQm13"),"EnvolverQm14": player.GetVar("EnvolverQm14"),"EnvolverQm15": player.GetVar("EnvolverQm15"),"Recursos1": player.GetVar("Recursos1"),"Recursos2": player.GetVar("Recursos2"),"Recursos3": player.GetVar("Recursos3"),"Recursos4": player.GetVar("Recursos4"),"Recursos5": player.GetVar("Recursos5"),"Recursos6": player.GetVar("Recursos6"),"Recursos7": player.GetVar("Recursos7"),"Recursos8": player.GetVar("Recursos8"),"Recursos9": player.GetVar("Recursos9"),Recursos10: player.GetVar("Recursos10"),Recursos11: player.GetVar("Recursos11"),Recursos12: player.GetVar("Recursos12"),Recursos13: player.GetVar("Recursos13"),Recursos14: player.GetVar("Recursos14"),Recursos15: player.GetVar("Recursos15"),"When1": player.GetVar("When1"),"When2": player.GetVar("When2"),"When3": player.GetVar("When3"),"When4": player.GetVar("When4"),"When5": player.GetVar("When5"),"When6": player.GetVar("When6"),"When7": player.GetVar("When7"),"When8": player.GetVar("When8"),"When9": player.GetVar("When9"),"When10": player.GetVar("When10"),"When11": player.GetVar("When11"),"When12": player.GetVar("When12"),"When13": player.GetVar("When13"),"When14": player.GetVar("When14"),"When15": player.GetVar("When15"),"Status1": player.GetVar("Status1"),"Status2": player.GetVar("Status2"),"Status3": player.GetVar("Status3"),"Status4": player.GetVar("Status4"),"Status5": player.GetVar("Status5"),"Status6": player.GetVar("Status6"),"Status7": player.GetVar("Status7"),"Status8": player.GetVar("Status8"),"Status9": player.GetVar("Status9"),Status10: player.GetVar("Status10"),Status11: player.GetVar("Status11"),Status12: player.GetVar("Status12"),Status13: player.GetVar("Status13"),Status14: player.GetVar("Status14"),Status15: player.GetVar("Status15")},
success: function(data)
{
console.log(data);
},
error: function(err) {
console.log('Error:', err);
}
});
return false;

As far, I know the code above is the key.

.replace(/\r\n?/g, ';;;')
Be the first to reply