How to check attachments in flow designer

chanikya
Kilo Sage

Hi All,

Version : PARIS PATCH10

How to check replied email has attachments Or Not in Flow designer.

find_real_file.png

 

@Ankur @Harshavardhan @Ankur Bawiskar @Anil Lande @Chuck Tomasi @Jaspal Singh @Rohila Voona 

@Michael Jones - CloudPires @Kieran Anson @Brad Bowman 
1 ACCEPTED SOLUTION

As an alternative, this could also be done with the help of an Action that can be used elsewhere too. I created a new Action, called it "Get Records Count"

Have defined a single input:

find_real_file.png

Next I have added a Script step that also has an input that looks the same as the Action input:

find_real_file.png

The code is pretty str8 fwd:

(function execute(inputs, outputs) {
  if (inputs.records && inputs.records.isValidRecord)
    outputs.count = inputs.records.getRowCount();
  else
    outputs.count = 0;
})(inputs, outputs);

And - of course - as visible in the picture, the Script Step also has an output, I named it count.

Finally the Action itself also has an output, again named the same as the Script step output:

find_real_file.png

And I have configured the Action to use the Script step's output as the Action's output value:

find_real_file.png

Once this is done and activated, I can use it as below:

find_real_file.pngOf course this will result in the Count data pill that I can use to check whether any attachments have been received:

find_real_file.png

View solution in original post

42 REPLIES 42

Vijaykumar2
Mega Expert

The below article may help you.

https://community.servicenow.com/community?id=community_article&sys_id=9ed305e2db63fb845129a851ca9619f7

 

Thanks,

Vijaykumar

-O-
Kilo Patron
Kilo Patron

So a couple if things to consider:

- remember inbound e-mail flows always run in the context of the identified user; that means if a user does not have rights to update something and the flow tries to update that thing, the flow will fail

- as far as I know if the e-mail's receive type is new, no new records will be automatically created, the flow has to do it itself.

Keeping that in mind, I have created a test flow as below and it works; the table I'm using is not the Case table, but the Ticket one, but things should work the same for Case too:

find_real_file.pngHowever notice that the receive type is reply, not new. Also while not visible, the Updates only change the Additional comments to which any user has write access.

For updating the Assignment group I added a call to sub-flow "CX | Update ticket" which is configured to be running with system user.

What I'm trying to say is that if you want this to work for when the e-mail reply is new, you need to move stuff into a sub-flow marked to run as system, create a new record and everything else in there. Or make sure the flow is not run if the user does not have consumer or customer roles. Otherwise creating a new case will fail, at least if security settings are the OOB ones.

I have also done a version of the flow that works on the Case table and where the e-mail receive type is new:

find_real_file.png

chanikya
Kilo Sage

Janos Proposed 2-solution on this.

Solution 1: script

this could also be done with the help of an Action that can be used elsewhere too. I created a new Action, called it "Get Records Count"

Have defined a single input:

find_real_file.png

Next I have added a Script step that also has an input that looks the same as the Action input:

find_real_file.png

The code is pretty str8 fwd:

(function execute(inputs, outputs) {
  if (inputs.records && inputs.records.isValidRecord)
    outputs.count = inputs.records.getRowCount();
  else
    outputs.count = 0;
})(inputs, outputs);

And - of course - as visible in the picture, the Script Step also has an output, I named it count.

Finally the Action itself also has an output, again named the same as the Script step output:

find_real_file.png

And I have configured the Action to use the Script step's output as the Action's output value:

find_real_file.png

Once this is done and activated, I can use it as below:

find_real_file.pngOf course this will result in the Count data pill that I can use to check whether any attachments have been received:

find_real_file.png

 

 

Solution 2 : Add " Look up records"

find_real_file.png

 

 

Result Of Solution 2

find_real_file.png

 

same way if we go with solution one just Need to replace of "Look up records"  with Script Event