function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PrafPraf 

How to verify if an attachment was made from within a workflow rule?

Hey Guys ... we have a custom object with a bunch of fields and use an Outbound Msg Notification to send the payload to our internal servers. However, there is a new requirement which I am unsure how to implement. Here is the use case:

1) User checks a checkbox, say named, Attach a File

2) We have an Outbound Msg triggered via a Workflow rule to send the payload out

3) If the checkbox value = true then before submitting/triggering the outbound msg, the page should direct the user to attach a document.

 

There is a related list on the page layout for notes and attachments. How can I verify or validate if the user has made an attachment before triggering the Workflow rule actions?

 

Another option is to display a pop up or warning window to the user that they need to make an attachment. But even then the attachment needs to come with the payload.

 

Any ideas or thoughts on how to go about doing this or researching this?

Thanks 

Force2b_MikeForce2b_Mike

Interesting case. The main issue you have is that a workflow rule cannot redirect the user to another page, and it seems you dont' want to send your outbound message until after the file is attached. Theoretically, a Trigger or Workflow on the Attachment object might work, but I'm fairly sure that Attachment does not support an Insert trigger.

 

One possible alternative is to use a VisualForce page to display your custom object. By using a custom controllerExtension you can setup the page (at page load time) to check the value of the checkBox. If it is checked and there is no attachment, then you could redirect the user to the page to add the file. When the page loads again it could detect that the attachment has been added and then send the outbound message to your servers.

 

Mike 

PrafPraf

Thx scrappydog ... I would also need to have my own attachment object apart from the custom object on the visual force page, correct? 

 

How about showing the user a warning msg pop up or something prior to the submission of the form, for the case if we don't want to verify an attachment prior to sending it? 

Force2b_MikeForce2b_Mike

You should be able to use SalesForce.com standard Attachment object on your custom object.

 

Unless I'm missing something, Attachments are a related list on an object so they're not entered at the same time that a user edits the main form. I suppose you could work around that by creating an entirely custom VisualForce edit page and include a field for the attachment. That's probably quite a bit more work and you lose the ability to manage multiple page layouts easily through the standard directive interface.