How to merge two catalog items flow into one in Flow desginer

LT_23
Tera Contributor
 Hello I have a need which is to merge two catalog items into a single one and I have 2 scripts (workflows) that I want to merge into a single one as well. 
Problem is I a want to display the action (add,modify,delete) inside the descritipion of the change request  created but it doesnt display it in the description :
 
test3445_2-1730144900237.png

Change request description field:

test3445_1-1730144801303.png

 

My expected result :

test3445_3-1730144987536.png

 

and here is the script I used in flow designer  and I want to combine into one script that will display both add and delete action inside the description : 

  var aliasArr = fd_data._1__get_catalog_variables.liste_d_alias_dns_ajouter;

           var description = "Comments:  " + fd_data._1__get_catalog_variables.comments + "\n"+

        "List of DNS aliases:  " + "\n";

    var j = 0 ;

    for (var i = 0; i < aliasArr.length; i++) {

    j = i + 1;

        description += "Name["+j+"]:  " + aliasArr[i].name + "\n" +

            "Domain["+j+"]:  " + aliasArr[i].domain + "\n" +

            "Name or IP address["+j+"]:  " + aliasArr[i].name_or_ip_address  + "\n\n"

     

    }

    return description;

 

 

var aliasArr = fd_data._1__get_catalog_variables.list_of_dns_delete;

var description = "Comments:  " + fd_data._1__get_catalog_variables.comments + "\n"+

    "List of DNS aliases:  " + "\n";

var j = 0 ;

for (var i = 0; i < aliasArr.length; i++) {

    j = i + 1;

    description += "Name["+j+"]:  " + aliasArr[i].name_remove + "\n" +

        "Domain["+j+"]:  " + aliasArr[i].domain_remove + "\n" +

        "Name or IP address["+j+"]:  " + aliasArr[i].name_or_ip_address_remove  + "\n\n"

}

return description;

 

 

Any help will be much appreciated.

6 REPLIES 6

Voona Rohila
Tera Patron

Hi @LT_23 

Try this

var aliasArr1 = fd_data._1__get_catalog_variables.liste_d_alias_dns_ajouter;
var description1 = '',
    description2 = '';
if (aliasArr1 != '') {
    description1 = "Comments:  " + fd_data._1__get_catalog_variables.comments + "\n" +
        "List of DNS aliases:  " + "\n";
    var j = 0;
    for (var i = 0; i < aliasArr1.length; i++) {
        j = i + 1;
        description1 += "Name[" + j + "]:  " + aliasArr1[i].name + "\n" +
            "Domain[" + j + "]:  " + aliasArr1[i].domain + "\n" +
            "Name or IP address[" + j + "]:  " + aliasArr1[i].name_or_ip_address + "\n\n"

    }
}
aliasArr2 = fd_data._1__get_catalog_variables.list_of_dns_delete;
if (aliasArr2 != '') {
    description2 = "Comments:  " + fd_data._1__get_catalog_variables.comments + "\n" +
        "List of DNS aliases:  " + "\n";
    var j = 0;
    for (var i = 0; i < aliasArr2.length; i++) {
        j = i + 1;
        description2 += "Name[" + j + "]:  " + aliasArr2[i].name_remove + "\n" +
            "Domain[" + j + "]:  " + aliasArr2[i].domain_remove + "\n" +
            "Name or IP address[" + j + "]:  " + aliasArr2[i].name_or_ip_address_remove + "\n\n"
    }
}
return description1 + description2;

Thanks so much for your help on the script, but when I try to save it I keep getting 

Cannot read properties of undefined (reading 'warnings') 

Can you please share screenshot of the code and error.

All good I mispelled a variable but somehow the change request is no longer created.