I want to have the details in one section in email notification

Pooja Khatri
Tera Contributor

Hi All ,

 

I have an existing functionality where I have two sections in my email notification as seen in the image below

 

PoojaKhatri_0-1697543065983.png

 

now I want to edit the section and I want to have all the ten fields one above the other 

 

I have this piece of code in my existing script include : 

 

if(task_class_name == 'change_request') {
            this.content = {
                one: [
                    {field: "Short Description", value: task.short_description.getDisplayValue()},
                    {field: "Change Coordinator", value: task.requested_by.getDisplayValue()},
                    {field: "Change Type", value: task.type.getDisplayValue()},
                    {field: "Configuration Item", value: task.cmdb_ci.getDisplayValue()},
                    {field: "Category", value: task.u_category.getDisplayValue()},
                    {field: "Hosting Impact", value: (task.u_hosting_impact) ? "true" : "false"},
                    ],
                two: [
                    {field: "Probability", value: task.u_probability.getDisplayValue()},
                    {field: "Risk", value: task.risk.getDisplayValue()},
                    {field: "Impact", value: task.impact.getDisplayValue()},
                    {field: "TWM", value: (task.u_third_weekend_maintenance) ? "true" : "false"},                  
                    {field: "Planned start date", value: (task.start_date.nil()) ? "" : this.getEST(task.start_date)},
                    {field: "Planned end date", value: (task.end_date.nil()) ? "" : this.getEST(task.end_date)}
                ]
            };
        }
 
what changes do I need to make in this script which will have the details in a formatted way one below the other and not in the section way .
4 REPLIES 4

shyamkumar VK
Kilo Patron

@Pooja Khatri  , Update this logic 

 

if(task_class_name == 'change_request') {
            this.content = {
                [
                    {field: "Short Description", value: task.short_description.getDisplayValue()},
                    {field: "Change Coordinator", value: task.requested_by.getDisplayValue()},
                    {field: "Change Type", value: task.type.getDisplayValue()},
                    {field: "Configuration Item", value: task.cmdb_ci.getDisplayValue()},
                    {field: "Category", value: task.u_category.getDisplayValue()},
                    {field: "Hosting Impact", value: (task.u_hosting_impact) ? "true" : "false"},
                
                    {field: "Probability", value: task.u_probability.getDisplayValue()},
                    {field: "Risk", value: task.risk.getDisplayValue()},
                    {field: "Impact", value: task.impact.getDisplayValue()},
                    {field: "TWM", value: (task.u_third_weekend_maintenance) ? "true" : "false"},                  
                    {field: "Planned start date", value: (task.start_date.nil()) ? "" : this.getEST(task.start_date)},
                    {field: "Planned end date", value: (task.end_date.nil()) ? "" : this.getEST(task.end_date)}
                   ],
            };
}
        
 
Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Hi @shyamkumar VK - I have already tried with this logic but at the start of [ bracket it is giving me an error of Parsing error : Unexpected token , can you please help me how can I fix this ?

@Pooja Khatri  , can you try with this logic 

 

if (task_class_name === 'change_request') {
    this.content = [
        { field: "Short Description", value: task.short_description.getDisplayValue() },
        { field: "Change Coordinator", value: task.requested_by.getDisplayValue() },
        { field: "Change Type", value: task.type.getDisplayValue() },
        { field: "Configuration Item", value: task.cmdb_ci.getDisplayValue() },
        { field: "Category", value: task.u_category.getDisplayValue() },
        { field: "Hosting Impact", value: (task.u_hosting_impact) ? "true" : "false" },
        { field: "Probability", value: task.u_probability.getDisplayValue() },
        { field: "Risk", value: task.risk.getDisplayValue() },
        { field: "Impact", value: task.impact.getDisplayValue() },
        { field: "TWM", value: (task.u_third_weekend_maintenance) ? "true" : "false" },
        { field: "Planned start date", value: (task.start_date.nil()) ? "" : this.getEST(task.start_date) },
        { field: "Planned end date", value: (task.end_date.nil()) ? "" : this.getEST(task.end_date) }
    ];
}
Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

@shyamkumar VK - I tried it with the below script , it has now stopped pasting the entire details in the email notification 

PoojaKhatri_0-1697544500079.png