• abruck
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I need to send a notification to some of my users every time a file is uploaded. 
I understand that files does not have the option to create workflows. 
So I need to create an apex trigger to do this. 
I have never written anything like this before and I would appreciate some quidance. 
All the best, 
Aidel Bruck
  • November 05, 2018
  • Like
  • 1

Hi, 

I am trying to create a visual force component that displays a simple list from a picklist field on a custom object. 

for some reason that I cannot figure out only one line appears out of the whole list. The rest just show up as blanks. 

This is the markup

<apex:page standardController="Financial_Approval_Request__c" recordSetvar="Financial_Request">
<apex:pageBlock >
<apex:form id="theForm">
<apex:panelGrid columns="2">

</apex:panelGrid>
<apex:pageBlockSection >
<apex:dataList var="c" value="{!Financial_Request}" id="list">
{!c.Drug_Name__c}
</apex:dataList>
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
</apex:page>

 

please advise, 

Thanks, 

Aidel

I need to send a notification to some of my users every time a file is uploaded. 
I understand that files does not have the option to create workflows. 
So I need to create an apex trigger to do this. 
I have never written anything like this before and I would appreciate some quidance. 
All the best, 
Aidel Bruck
  • November 05, 2018
  • Like
  • 1
I have the following trigger I wrote for ContentDocument
I want to send an email alert to various users when a file is uploaded 
This is the code and I would like to know how to test it
Also I need a way to get the account name the file is associated with

trigger NewFileAlert on ContentDocument (after insert) 
{
// Step 0: Create a master list to hold the emails we'll send
  List<Messaging.SingleEmailMessage> mails = 
  new List<Messaging.SingleEmailMessage>();
  
  for (ContentDocument newDoc : Trigger.new) 
  {
      // Step 1: Create a new Email
      Messaging.SingleEmailMessage mail = 
      new Messaging.SingleEmailMessage();
    
      // Step 2: Set list of people who should get the email
      List<String> sendTo = new List<String>();
      sendTo.add(list of all addresses)
      mail.setToAddresses(sendTo);
    
      // Step 3: Set who the email is sent from
      mail.setReplyTo('myaddress');
      mail.setSenderDisplayName('Aidel Bruck');
    
      // (Optional) Set list of people who should be CC'ed
      //List<String> ccTo = new List<String>();
      //ccTo.add('business@bankofnigeria.com');
      //mail.setCcAddresses(ccTo);

      // Step 4. Set email contents - you can use variables!
      mail.setSubject('New Document Added');
      String body = 'Please note: A new document has been added/n  ';
      body += 'File name: '+ newdoc.title+'/n' ;
      body += 'Created By: '+ newdoc.createdbyid+ '/n';
      body += 'Created Date: '+ newdoc.CreatedDate+ '/n';
      body += 'link to file: '+ System.URL.getSalesforceBaseUrl().getHost()+newdoc.id;
      mail.setHtmlBody(body);
    
      // Step 5. Add your email to the master list
      mails.add(mail);
    }
  // Step 6: Send all emails in the master list
  Messaging.sendEmail(mails);
}

Thanks!

Hi, 

I am trying to create a visual force component that displays a simple list from a picklist field on a custom object. 

for some reason that I cannot figure out only one line appears out of the whole list. The rest just show up as blanks. 

This is the markup

<apex:page standardController="Financial_Approval_Request__c" recordSetvar="Financial_Request">
<apex:pageBlock >
<apex:form id="theForm">
<apex:panelGrid columns="2">

</apex:panelGrid>
<apex:pageBlockSection >
<apex:dataList var="c" value="{!Financial_Request}" id="list">
{!c.Drug_Name__c}
</apex:dataList>
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
</apex:page>

 

please advise, 

Thanks, 

Aidel

A few weeks ago the search function for this board changed, MUCH for the worse. Now it's just a single search box, no "advanced" option, and I get some generic links instead of the detailed results I used to get, that sometimes just take me to a random board instead of a specific post! The new search function is awful, very frustrating and almost useless. Salesforce does so much for the user interface and productivity of users, but this kills what used to be a great resource.

FYI I'm using Firefox on a Mac, such an unusual combination.