Hi @chrismca73 ,
Thanks for the response, but still facing the error regarding CRLF.
Each line of csv file should have this CRLF/LF in it. We can see if these character is present of not using either by View non-printable unicode characters (soscisurvey.de) or we can see it inside notepad++.
So these CRLF characters are being converted to period (.)
The requirement was to add double qoutes around all the not null values.
(RecordType value is hardcoded).
Code i have written :
var getPersonModifiedSinceResponse = JSON.parse(context.getVariable(‘response.content’));
var csvString = ‘“Name”,“DW_MiddleInitial__c”,“DW_BirthDate__c”,“RecordTypeId”\r\n’;
for(var i=0; i < getPersonModifiedSinceResponse.length; i++)
{
firstName[i]= getPersonModifiedSinceResponse[i].FirstName === null ? null : ‘"’+ getPersonModifiedSinceResponse[i].FirstName + ‘"’;
middleInitials[i] = getPersonModifiedSinceResponse[i].MiddleInitials=== null ? null : ‘"’+getPersonModifiedSinceResponse[i].MiddleInitials + ‘"’;
birthdate[i] = getPersonModifiedSinceResponse[i].BirthDate === null ? null : ‘"’ + getPersonModifiedSinceResponse[i].BirthDate.slice(0,10) + ‘"’;
csvString += firstName[i] +“,” +middleInitials[i] +“,”+birthdate[i]+‘,"’+“0124C0000006742”+‘"’+“\r\n”;
}
context.setVariable(“csvString”,csvString);
Response I am getting(check inside the above mentioned site) :
“Name”,“DW_MiddleInitial__c”,“DW_BirthDate__c”,“RecordTypeId”.“batch”,null,“update”,null,“0124C0000006742”.“batch”,null,“update”,null,“0124C0000006742”.“batch”,null,“update”,null,“0124C0000006742”