0

I wrote a SSJS scripts for parsing a record, however, the records have not been pushed into Data Extension even though the automation ran successfully as I mentioned. Below is the SSJS script that I wrote.

<script runat = "server" >
    
    Platform.Load("Core", "1.1.1");

    var DE = DataExtension.Init("Notiforce_Import_DE");
    var data = DE.Rows.Retrieve();
    var data_length = data.length;
    var raw;
    var splited;
    var jnm;
    var jnv;
    var avn;
    var avi;
    var cck;
    var dii;
    var Success;
    var Fail;
    var comp_dt;
    var chn1;
    var chn2;
    var chncd1; 
    var chncd2; 
    var chn;    //최종발송채널
    var chncd;  //최종발송코드
    var SR;    //최종발송결과

    
    for(var i=0; i<data_length; i++){
  
        raw = data[i].messageid;
        splited = raw.split("&"); // &를 기준으로 데이터 분리, 결과물은 spllited[0],splited[1] 이런식으로 나와서 밑에서 옆에 .split은 또 나누는꼴이 됨
        var jnm = splited[0]; 
        var jnv = splited[1];
        var avn = splited[2];
        var avi = splited[3];
        var cck = splited[4];
        var dii = splited[5];
        var comp_dt = data[i].comp_dt;
        var chn1 = data[i].channel1;
        var chn2 = data[i].channel2;
        var chncd1 = data[i].channel1_f_code;
        var chncd2 = data[i].channel2_f_code;
        

             if((chn2 == null || chn2 == '') && (chncd2 == null || chncd2 =='')) {
                 chn = chn1;
                 chncd = chncd1;
             }  else {
                 chn = chn2;
                 chncd = chncd2;
             }
             if(chncd == '1000') {
                 SR = 'Success';
             } else {
                 SR = 'Fail'; 
             }
             var rows = Platform.Function.UpsertData("Notiforce_Parsing_Final_test", ["JourneyName", "JourneyVersion", "ActivityID", "ContactKey", "RequestDate"],[jnm, jnv, avi, cck, comp_dt
             ],["ActivityName", "Channel", "SendResultCode", "SendResult"],[avn, chn, chncd, SR]);

    
                
           

    

      }
                        
</script> 

The initial Data Extension is "Notiforce_Import_DE" and I want to parse the "messageid" (pk) fields' value. It is shown below like this.

EX) messageid: New Journey - 2022년 1월 18일 오후 3.40&1&Notiforce-stg&170bd3f9-3450-4d3f-8968-0afb0be55fe7&11111&c1656bad-278f-4f30-bdab-b727f794477e

And the Destination DE name is Notiforce_Parsing_Final_test having with those of fields name that I mentioned in SSJS Script.

Once I click to run the automation, it runs well but the Destination DE remained as empty. Anyone please please can help me to configure the issue here and the solution to solve this?

Thanks in advance!

New contributor
hyeonjinkim is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

hyeonjinkim is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.