cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

FSM Business Rule: Usage of JavaScript in HTML construct

christoph_kurtz2
Participant
1,307

Hi all,

We are struggling with an issue of the JavaScript integration into HTML code while creating a business rule in FSM.

The business case is that we want to use several equipments in one service call. After assignment of the related activity to the technician, he should receive an email with the list of the affected equipments. For one equipment, this works very well.

Here is the example when one equipment is listed

We want to loop over all assigned equipments and want to display them in a HTML table row. To realize that, we want to add related Javascript code into the HTML source within the <script>-tags.

After saving the source and reopen it, the tags <script> and the content in-between are deleted. Moreover, the code is not executed when assigning new activities to orders.

Do you have any idea how we can solve this situation?

Best regards,

Christoph

Accepted Solutions (0)

Answers (3)

Answers (3)

wendy_snyder
Advisor
Advisor

Hi Christoph, It is not possible to use the script tags in an email. We would propose to use a variable (i.e equipments) for your array and then in the email you could access these equipments via this variable and print them out using a script like below:

${equipments.map(function(equipment){return "id: " + equipment.id + " name: " + equipment.name + " code: " + equipment.code})}

If this is not sufficient, can you please send me what you are trying to do in the script?

Kind Regards,

Wendy

abel_dicka
Explorer
0 Kudos

Hello christoph.kurtz2,

let me know if you still need a solution for your problem of displaying a table in an email.

regards,

Abel

christoph_kurtz2
Participant
0 Kudos

Hi Wendy,

Thanks so far for your quick reply!

We want to display the equipments in an HTML table. As we don't have a limit of max. assigned equipments, this must be dynamically created and therefore, wen want to use the mentioned script.

Do you have an idea how this can be handled? If you need more details, please let me know.

Best regards,

Christoph

VishnAndr
Active Contributor
0 Kudos

Array.map method proposed by Wendy doesn't restrict you on the numbers of equipments you have. It works quite well. You can also try to use array.reduce. it might be even better in your case.