Power automate - Si pièce jointe

Brass Contributor

Hello,

 

J'ai un flux de cloud, qui s'exécute à la soumission d'un formulaire Forms. Dans ce formulaire, il y a un champ d'upload de fichier (un seul). J'ai réussi à le récupérer dans mon flux et le joindre en pièce jointe dans un mail (envoyer un e-mail à partir d'une boite aux lettres partagée V2). S'il n'y a pas de fichier, le flux échoue.

 

J'ai mis une condition si la pièce jointe = ""...

true: mail sans pièce jointe

false: mail avec pièce jointe

 

Ca fonctionne mais je ne trouve pas ça très propre, et pas très pratique, le corps du mail doit être édité à deux endroits.

J'ai voulu avoir une seule création de mail, et de placer la condition au niveau d'une expression sur le nom et contenu de la pièce jointe.

if(equals(outputs('Obtenir_les_détails_de_la_réponse')?['body/r6b840f03172742e19e25fb1b1325444c'],''),'',first(body('Analyser_JSON'))?['name'])

if(equals(outputs('Obtenir_les_détails_de_la_réponse')?['body/r6b840f03172742e19e25fb1b1325444c'],''),'',outputs('Obtenir_le_contenu_du_fichier_à_l''aide_du_chemin_d''accès_2')?['body'])

 

Mais ça échoue. Vous sauriez m'éclairer sur la bonne pratique à avoir?

 

Bonne journée,

4 Replies

@thelastredwolf 

 

I assume an attachment is mandatory within your Forms questionnaire.

The first part you seem to have already:

Micca0815_0-1648833208268.png


Now let us have a look at the attachments.
Each file will be stored within your OneDrive - if the Form is not shared with an O365 group.
Otherwise the files will be within the O365 group associated Sharepoint teamsite.

after Parse JSON 

apply to eachapply to each


Then 'send mail'

send mailsend mail

 


  

Hello very good tips
May i have the entire JSON Schema please Micca ?
I cannot generate it easily ?
It could be helpfull to me to understand the mapping.
Thanks in advance.
Best regards
Grégoire
@Micca0815
It's ok for parsing ! Yes
But if have to do parsing in 2 times.
And when i send a mail with the sub pars => For each is englobed the mail v3 ?

I try the array(triggerOutputs()?['body']) instead of body alone.
But no result

@Micca0815
It's ok for parsing ! Yes
But if have to do parsing in 2 times.
And when i send a mail with the sub pars => For each is englobed the mail v3 ?

I try the array(triggerOutputs()?['body']) instead of body alone.

But no result
@Micca0815