Views:

Scenario Overview

In this scenario the business requirement is to remove all PDF email attachments that are over 1MB in size. The end user needed to do this manually from a Command Console.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • We create a formula of type 'Command Console'
  • The formula retrieves the first 10 email attachments to be deleted
  • It then deletes the attachment

N52 Formula Manager Steps

The following set of steps will set this formula up for you,

  • Create a new formula of type 'Command Console'
  • Copy & paste the formula below into the formula description field
  • Click save

Formula

DeleteRecordsFD('RemoveEmailAttachments')

The following set of steps will create the formula detail named 'RemoveEmailAttachments' for you,

  • Using the subgrid in the bottom right hand corner create a new formula detail record.
  • Set the name field to 'RemoveEmailAttachments'
  • Set the fetch-xml to the query below
  • Click Save

Fetch-Xml

<fetch version="1.0" output-format="xml-platform" count="10" mapping="logical" distinct="false">
  <entity name="activitymimeattachment">
    <attribute name="activitymimeattachmentid" />
    <attribute name="filename" />
    <attribute name="filesize" />
    <attribute name="mimetype" />
    <filter type="and">
      <condition attribute="mimetype" operator="eq" value="application/pdf" />
      <condition attribute="filesize" operator="gt" value="1024000" />
    </filter>
  </entity>
</fetch>

Now when you want to execute the command just click the lighting bolt on the North52 formula editor ribbon. This will pop-up a dialog box which you can execute the command.