• Gallery Integration
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 13
    Replies
Hi Everyone,

I have created a simple visualforce page to create a new contact.
However, I want to make a validation to pop out an error message if the email is already existed.

What can I add in the controller class to achieve this?

Here is the code for the visualforce page
<apex:page standardController="Contact">

    <h1>Registration Page</h1>

    <apex:form >

        <apex:pageMessages />

        <table>

            <tr>

                <th>First Name:</th>

                <td><apex:inputText value="{Contact.FirstName}"/></td>

            </tr>
            
            <tr>

                <th>Last Name:</th>

                <td><apex:inputText value="{!Contact.LastName}"/></td>

            </tr>

            <tr>

                <th>Email Address:</th>

                <td><apex:inputText value="{!Contact.Email}"/></td>

            </tr>
            
            <tr>
            <td>
            <apex:pageBlockButtons location="bottom">
     		<apex:commandButton action="{!save}" value="Save"/>
    		</apex:pageBlockButtons>
            </td>
            </tr>


        </table>

    </apex:form>

</apex:page>

Really appreciate for the help


 
Hi Everyone,

I have been trying to create an email notiication to task assignee upon a new attachment is uploaded to the task.
I created a checkbox field in activites called "Send_Attachment_Email__c".
If this checkbox is true, then a workflow to fire the email notification will be run.

However, I have a problem in the trigger to check the checkbox to true when an attachment is uploaded to task.
Can anybody help me?
 
trigger attachmentTrig on Attachment (after insert) {
  // 1. Get List of Object Ids to notify on
    Set<Id> objectIds = new Set<Id>();

     
    // 2. Loop through list of attachments on Task
    for(Attachment a:trigger.new){

         String keyPrefix = a.ParentId;
         if(keyPrefix == 'Task'){
            objectIds.add(a.ParentId);
         }
    }

     
    // 3. Set the Send Attachment Notification Email field to True
    if(objectIds.size() > 0){

        List<Task> TaskList = [SELECT Id FROM Task WHERE Id IN :objectIds];
         
        for(Task obj:TaskList){
            obj.Send_Attachment_Email__c = true;
        }
      
        if(TaskList.size() > 0){
            update TaskList;
        }      
    }    
}

 
Hi Everyone,

I am trying to add 100++ campaign members to the campaign that I have created.
However while doing this we encounter a SOQL queries:101 error.
After doing some checking this error is caused by this 3 process builders:
1. Process builder to update a campaign member field based on contact field whenever it is created.
2. Process builder to update a campaign member field based on other campaign member field whenever it is created.
3. Process builder to update campaign member field based on other campaign field whenever it is created or edited.

If the we limit the upload to 25 or 50 members at once we will not receive this error.
After deactivating these 3 process builder the upload can work correctly even with 100++ member at once

Are there any solution to solve this? Does process builder do not support bulkified upload?

User-added image
How can task assignee get an email notification when there is an attachment added to the task?
Hi All,

Previously I am using a process builder to update a field called "Reminder Date" in campaign member while the field "Reminder Date" in the campaign was changed/edited.
However, I hit too many soql queries error while uploading 100++ members at once.

So I deactivate the process builder and change it to Apex Trigger instead.
However, this bulk trigger seems not working to me, I use this same logic to update other field from contact at it works fine.
Are there anything that I am missing from this code?


trigger CampaignMemberUpdateReminderDate on CampaignMember (before insert, before update){

    Set<id> CampaignMemberIds = new Set<id>();
    for (CampaignMember a : Trigger.new)
        CampaignMemberIds.add(a.CampaignId);   

    Map<id, Campaign> campaigns = new Map<id, Campaign>([Select Reminder_Date__c from Campaign Where Id in :CampaignMemberIds]);  

    // iterate over the list of records being processed in the trigger and
    for (CampaignMember a : Trigger.new)
    { a.Reminder_Date__c = campaigns.get(a.CampaignId).Reminder_Date__c;
    }

}
 
Hi All,

So I have a picklist field containing several set of value.
One of the value is "PD - Chairman's Circle".

When a record is created through an apex code with this value, instead of using the same value, a new picklist value with exact name is created.
I wonder what causes this? Something to do with UTF-8 encoding?

 User-added image

Here is my apex code:

donationRecord.Donor_Tier__c = 'PD - ' + tokenWrapperInstance.category;
Hi Everyone,

I have been trying to create an email notiication to task assignee upon a new attachment is uploaded to the task.
I created a checkbox field in activites called "Send_Attachment_Email__c".
If this checkbox is true, then a workflow to fire the email notification will be run.

However, I have a problem in the trigger to check the checkbox to true when an attachment is uploaded to task.
Can anybody help me?
 
trigger attachmentTrig on Attachment (after insert) {
  // 1. Get List of Object Ids to notify on
    Set<Id> objectIds = new Set<Id>();

     
    // 2. Loop through list of attachments on Task
    for(Attachment a:trigger.new){

         String keyPrefix = a.ParentId;
         if(keyPrefix == 'Task'){
            objectIds.add(a.ParentId);
         }
    }

     
    // 3. Set the Send Attachment Notification Email field to True
    if(objectIds.size() > 0){

        List<Task> TaskList = [SELECT Id FROM Task WHERE Id IN :objectIds];
         
        for(Task obj:TaskList){
            obj.Send_Attachment_Email__c = true;
        }
      
        if(TaskList.size() > 0){
            update TaskList;
        }      
    }    
}

 
Hi Everyone,

I have created a simple visualforce page to create a new contact.
However, I want to make a validation to pop out an error message if the email is already existed.

What can I add in the controller class to achieve this?

Here is the code for the visualforce page
<apex:page standardController="Contact">

    <h1>Registration Page</h1>

    <apex:form >

        <apex:pageMessages />

        <table>

            <tr>

                <th>First Name:</th>

                <td><apex:inputText value="{Contact.FirstName}"/></td>

            </tr>
            
            <tr>

                <th>Last Name:</th>

                <td><apex:inputText value="{!Contact.LastName}"/></td>

            </tr>

            <tr>

                <th>Email Address:</th>

                <td><apex:inputText value="{!Contact.Email}"/></td>

            </tr>
            
            <tr>
            <td>
            <apex:pageBlockButtons location="bottom">
     		<apex:commandButton action="{!save}" value="Save"/>
    		</apex:pageBlockButtons>
            </td>
            </tr>


        </table>

    </apex:form>

</apex:page>

Really appreciate for the help


 
Hi Everyone,

I have been trying to create an email notiication to task assignee upon a new attachment is uploaded to the task.
I created a checkbox field in activites called "Send_Attachment_Email__c".
If this checkbox is true, then a workflow to fire the email notification will be run.

However, I have a problem in the trigger to check the checkbox to true when an attachment is uploaded to task.
Can anybody help me?
 
trigger attachmentTrig on Attachment (after insert) {
  // 1. Get List of Object Ids to notify on
    Set<Id> objectIds = new Set<Id>();

     
    // 2. Loop through list of attachments on Task
    for(Attachment a:trigger.new){

         String keyPrefix = a.ParentId;
         if(keyPrefix == 'Task'){
            objectIds.add(a.ParentId);
         }
    }

     
    // 3. Set the Send Attachment Notification Email field to True
    if(objectIds.size() > 0){

        List<Task> TaskList = [SELECT Id FROM Task WHERE Id IN :objectIds];
         
        for(Task obj:TaskList){
            obj.Send_Attachment_Email__c = true;
        }
      
        if(TaskList.size() > 0){
            update TaskList;
        }      
    }    
}

 
Hi Everyone,

I am trying to add 100++ campaign members to the campaign that I have created.
However while doing this we encounter a SOQL queries:101 error.
After doing some checking this error is caused by this 3 process builders:
1. Process builder to update a campaign member field based on contact field whenever it is created.
2. Process builder to update a campaign member field based on other campaign member field whenever it is created.
3. Process builder to update campaign member field based on other campaign field whenever it is created or edited.

If the we limit the upload to 25 or 50 members at once we will not receive this error.
After deactivating these 3 process builder the upload can work correctly even with 100++ member at once

Are there any solution to solve this? Does process builder do not support bulkified upload?

User-added image
How can task assignee get an email notification when there is an attachment added to the task?
Hi All,

So I have a picklist field containing several set of value.
One of the value is "PD - Chairman's Circle".

When a record is created through an apex code with this value, instead of using the same value, a new picklist value with exact name is created.
I wonder what causes this? Something to do with UTF-8 encoding?

 User-added image

Here is my apex code:

donationRecord.Donor_Tier__c = 'PD - ' + tokenWrapperInstance.category;