- Lynn the AFTD SysAdmin
- NEWBIE
- 25 Points
- Member since 2015
- IT Consultant
- AFTD
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
2Replies
pre-defining the Reply-to address for emails
We are using SF with the NPSP.
We send out Thank-you emails for received donations using the Send an Email button on the Activity History Related List on the Opportunities page. We need to be able to set the reply-to address to a group inbox, so when recipients reply to the emails they do not go to the users inbox.
I would either like to pre-set the Reply-to address or add a Reply-to address field to the Email Message:Send and Email page layout.
We send out Thank-you emails for received donations using the Send an Email button on the Activity History Related List on the Opportunities page. We need to be able to set the reply-to address to a group inbox, so when recipients reply to the emails they do not go to the users inbox.
I would either like to pre-set the Reply-to address or add a Reply-to address field to the Email Message:Send and Email page layout.
-
- Lynn the AFTD SysAdmin
- September 26, 2017
- Like
- 0
- Continue reading or reply
Need to remove Develop and Deploy from App Setup
I need to be able to remove the Setup->App Setup->Develop as well as the Setup->App Setup->Deploy options from the Setup menu for a certain User profile while still allowing that profile to access Setup->App Setup->Customize and Setup->App Setup->Create options. I can't find which Profile settings will do that for me.
Thanks!
Thanks!
-
- Lynn the AFTD SysAdmin
- October 18, 2016
- Like
- 0
- Continue reading or reply
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
I am trying to deploy new functionality to our production instance with a number of custome objects. One fo the objects has 2 master-detail fields as well as a Lookup field. When attempting to deploy using change sets I get the following error message related to the Lookup field:
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
I cannot change the lookup field to a MasterDetail type and I cannot figure out how to change The sharingModel for that object, under the sharing settings it says "You cannot create sharing rules for this item." under the Sharing Rules section.
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
I cannot change the lookup field to a MasterDetail type and I cannot figure out how to change The sharingModel for that object, under the sharing settings it says "You cannot create sharing rules for this item." under the Sharing Rules section.
-
- Lynn the AFTD SysAdmin
- May 06, 2016
- Like
- 0
- Continue reading or reply
Need a customized Edit/New Account and Edit/New Contact page layout
I cannot, for the life of me find where I can customize the page layout for editing or creating a new account or contact record. Surrently there are fields on these pages, that are not relevent when creating a new record and many custom fields that are relevent are not on these pages.
Thanks,
Lynn
Thanks,
Lynn
-
- Lynn the AFTD SysAdmin
- February 16, 2016
- Like
- 0
- Continue reading or reply
Messaging.SingleEmailMessage Test Code
I have the following trigger on Contacts to send an email to one of our managers when a contact 'deactivated', however I don't know how to test the Messaging.SingleEmailMessage() code and my test covereage is not enough:
trigger InactiveNotificationTrigger on Contact (after update) {
for (Contact c : Trigger.new){
if(Trigger.oldMap.get(c.id).Record_Status__c == 'Active' && c.Record_Status__c == 'Inactive'){
List<ID> ModID = New List<ID>();
ModID.add(c.LastModifiedById);
string FullEmailTxt;
List<User> ModUser = [Select ID, name from user where ID in: ModID];
for(integer i = 0 ; i < ModUser.size(); i++){
string emailTxt1 = 'Dear Development and Communications Director, ';
string emailtxt2 = 'The contact, '+c.FirstName+''+c.LastName+', has been marked inactive by '+ModUser[i].name+' on '+c.LastModifiedDate+'.';
string emailTxt3 = 'To review the contact please follow the link: '+System.URL.getSalesforceBaseUrl().toExternalForm()+'/'+c.Id+'.';
FullEmailTxt = emailTxt1+'\n'+'\n'+emailTxt2+'\n'+'\n'+emailTxt3+'\n'+'\n'+'Cheers!';
}
List<User> DevComMng = [Select ID, email from user where Title = 'DevComm Director'];
// for testing only List<User> DevComMng = [Select ID, email from user where Name = 'System Administrator'];
for(integer i = 0 ; i < DevComMng.size(); i++){
String[] toAddresses = new String[] {DevComMng[i].email};
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(toAddresses);
email.setSenderDisplayName('Salesforce Administration');
email.setSubject('Inactive Contact Allert');
email.setBccSender(false);
email.setPlainTextBody(FullEmailTxt);
email.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}
Note n = new note();
n.ParentID = c.id; n.Title = 'Inactive Notification Sent'; n.body = FullEmailTxt;
insert n;
}
}
}
Here the test code I have now:
@isTest
private class TestInactiveNotificationTrigger {
@isTest static void TestInactiveNotificationTrigger() {
// Test data setup
// Create a Board Campaign and assign and insert a current and former board member
Contact con = new Contact(FirstName='Test',LastName='Contact');
insert con;
con.Status__c = 'Inactive';
// con.Inactive_Reason__c = 'Deceased';
update con;
// Verify
// In this case the inserted contact record should have been updated as GRE Volunteer by the trigger,
// so verify that we got back an empty search.
List<ID> nID = New List<ID>();
nID.add(con.id);
List<Note> n = [SELECT id FROM Note WHERE ParentID in : nID];
System.assert( (n.size() == 0), 'Notification Trigger failed.');
}
}
trigger InactiveNotificationTrigger on Contact (after update) {
for (Contact c : Trigger.new){
if(Trigger.oldMap.get(c.id).Record_Status__c == 'Active' && c.Record_Status__c == 'Inactive'){
List<ID> ModID = New List<ID>();
ModID.add(c.LastModifiedById);
string FullEmailTxt;
List<User> ModUser = [Select ID, name from user where ID in: ModID];
for(integer i = 0 ; i < ModUser.size(); i++){
string emailTxt1 = 'Dear Development and Communications Director, ';
string emailtxt2 = 'The contact, '+c.FirstName+''+c.LastName+', has been marked inactive by '+ModUser[i].name+' on '+c.LastModifiedDate+'.';
string emailTxt3 = 'To review the contact please follow the link: '+System.URL.getSalesforceBaseUrl().toExternalForm()+'/'+c.Id+'.';
FullEmailTxt = emailTxt1+'\n'+'\n'+emailTxt2+'\n'+'\n'+emailTxt3+'\n'+'\n'+'Cheers!';
}
List<User> DevComMng = [Select ID, email from user where Title = 'DevComm Director'];
// for testing only List<User> DevComMng = [Select ID, email from user where Name = 'System Administrator'];
for(integer i = 0 ; i < DevComMng.size(); i++){
String[] toAddresses = new String[] {DevComMng[i].email};
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(toAddresses);
email.setSenderDisplayName('Salesforce Administration');
email.setSubject('Inactive Contact Allert');
email.setBccSender(false);
email.setPlainTextBody(FullEmailTxt);
email.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}
Note n = new note();
n.ParentID = c.id; n.Title = 'Inactive Notification Sent'; n.body = FullEmailTxt;
insert n;
}
}
}
Here the test code I have now:
@isTest
private class TestInactiveNotificationTrigger {
@isTest static void TestInactiveNotificationTrigger() {
// Test data setup
// Create a Board Campaign and assign and insert a current and former board member
Contact con = new Contact(FirstName='Test',LastName='Contact');
insert con;
con.Status__c = 'Inactive';
// con.Inactive_Reason__c = 'Deceased';
update con;
// Verify
// In this case the inserted contact record should have been updated as GRE Volunteer by the trigger,
// so verify that we got back an empty search.
List<ID> nID = New List<ID>();
nID.add(con.id);
List<Note> n = [SELECT id FROM Note WHERE ParentID in : nID];
System.assert( (n.size() == 0), 'Notification Trigger failed.');
}
}
-
- Lynn the AFTD SysAdmin
- January 20, 2016
- Like
- 0
- Continue reading or reply
Prompt for certain Record Types on New Opportunity List Button
I am trying to create a new list button on opportunity where the user should be prompted to choose from 3 of our currently 7 opportunity record types. I have to clue where to even begin solving this. My Button is currently defined as follows:
/006/e?
ent=Opportunity
&retURL=%2F{!Contact.Id}
&accid={!Account.Id}
&opp3={!Contact.Name} - Donation {!YEAR( TODAY() )}
&opp9={!TODAY()}
&opp11=Prospect ID
When the button is used it defaults to the master Record Type, but I want to design the button so it prompts the user to select the Record Type from a subset of types.
Any suggestions ideas are welcome. At a minimum I would like to at least have the user prompted to select any of the current record types.
/006/e?
ent=Opportunity
&retURL=%2F{!Contact.Id}
&accid={!Account.Id}
&opp3={!Contact.Name} - Donation {!YEAR( TODAY() )}
&opp9={!TODAY()}
&opp11=Prospect ID
When the button is used it defaults to the master Record Type, but I want to design the button so it prompts the user to select the Record Type from a subset of types.
Any suggestions ideas are welcome. At a minimum I would like to at least have the user prompted to select any of the current record types.
-
- Lynn the AFTD SysAdmin
- November 12, 2015
- Like
- 0
- Continue reading or reply
Attempting to schedule a batch Apex on Opportunities without results
I have written the following piece of batch apex code to be run nightly (using a scheduable class call). I have tested all the stage and date conditions seperately, but I cannot seem to get the class to work. I get no error messages on compilation or run time, but nothing ever happens (the calls for follow-up or email alert aren't invoked). I am drawing a blank an have stared at the code for too long, any help would be appreciated!
Cheers!
global class UpdateOppstoDormant implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext BC){
String query = 'SELECT Id, StageName, CloseDate, NextActivityDate__c, LastActivityDate FROM Opportunity WHERE StageName !=\''+String.escapeSingleQuotes('Received')+'\'';
return Database.getQueryLocator(query);
} //end query
global void execute(Database.BatchableContext BC, List<Opportunity> scope){
List<ID> DormantProspectIDs = New List<ID>();
List<ID> DormantRenewalIDs = New List<ID>();
for(sObject s : scope){
Opportunity o = (Opportunity)s;
//check if opportunities are prospects
if(o.Stagename == 'Prospect ID' || o.Stagename == 'Prospect Engaged'){
// check activity dates to establish Prospect dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 30) &&
(date.today().daysBetween(o.CloseDate) < 180) &&
(o.NextActivityDate__c == NULL || o.NextActivityDate__c < date.today()) ){
DormantProspectIDs.add(o.ID);
} //end activity date check
} //end dormant prospects
//check if opportunities are renewals
if(o.StageName == 'Renewal Potential' || o.StageName == 'Renewal Likely'){
// check activity dates to establish Renewal dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 90) &&
(o.NextActivityDate__c == NULL || date.today().daysBetween(o.NextActivityDate__c) > 90) ){
DormantRenewalIDs.add(o.ID);
} //end activity date check
} //end dormant Renewals
}
//for Dormant Prospects
List<Opportunity> DormantProspects = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantProspectIDs];
InactiveOpp.NewFollowUpTask(DormantProspects);
InactiveOpp.OwnerEmailAllert(DormantProspects);
//for Dormant Renewals
List<Opportunity> DormantRenewals = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantRenewalIDs];
InactiveOpp.RenewalFolloUpTask(DormantRenewals);
InactiveOpp.PotentialRenewalDomantAllert(DormantRenewals);
} //end execute
global void finish(Database.BatchableContext BC){
} //end finish
} //end class
Cheers!
global class UpdateOppstoDormant implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext BC){
String query = 'SELECT Id, StageName, CloseDate, NextActivityDate__c, LastActivityDate FROM Opportunity WHERE StageName !=\''+String.escapeSingleQuotes('Received')+'\'';
return Database.getQueryLocator(query);
} //end query
global void execute(Database.BatchableContext BC, List<Opportunity> scope){
List<ID> DormantProspectIDs = New List<ID>();
List<ID> DormantRenewalIDs = New List<ID>();
for(sObject s : scope){
Opportunity o = (Opportunity)s;
//check if opportunities are prospects
if(o.Stagename == 'Prospect ID' || o.Stagename == 'Prospect Engaged'){
// check activity dates to establish Prospect dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 30) &&
(date.today().daysBetween(o.CloseDate) < 180) &&
(o.NextActivityDate__c == NULL || o.NextActivityDate__c < date.today()) ){
DormantProspectIDs.add(o.ID);
} //end activity date check
} //end dormant prospects
//check if opportunities are renewals
if(o.StageName == 'Renewal Potential' || o.StageName == 'Renewal Likely'){
// check activity dates to establish Renewal dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 90) &&
(o.NextActivityDate__c == NULL || date.today().daysBetween(o.NextActivityDate__c) > 90) ){
DormantRenewalIDs.add(o.ID);
} //end activity date check
} //end dormant Renewals
}
//for Dormant Prospects
List<Opportunity> DormantProspects = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantProspectIDs];
InactiveOpp.NewFollowUpTask(DormantProspects);
InactiveOpp.OwnerEmailAllert(DormantProspects);
//for Dormant Renewals
List<Opportunity> DormantRenewals = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantRenewalIDs];
InactiveOpp.RenewalFolloUpTask(DormantRenewals);
InactiveOpp.PotentialRenewalDomantAllert(DormantRenewals);
} //end execute
global void finish(Database.BatchableContext BC){
} //end finish
} //end class
-
- Lynn the AFTD SysAdmin
- October 28, 2015
- Like
- 0
- Continue reading or reply
Prompt for certain Record Types on New Opportunity List Button
I am trying to create a new list button on opportunity where the user should be prompted to choose from 3 of our currently 7 opportunity record types. I have to clue where to even begin solving this. My Button is currently defined as follows:
/006/e?
ent=Opportunity
&retURL=%2F{!Contact.Id}
&accid={!Account.Id}
&opp3={!Contact.Name} - Donation {!YEAR( TODAY() )}
&opp9={!TODAY()}
&opp11=Prospect ID
When the button is used it defaults to the master Record Type, but I want to design the button so it prompts the user to select the Record Type from a subset of types.
Any suggestions ideas are welcome. At a minimum I would like to at least have the user prompted to select any of the current record types.
/006/e?
ent=Opportunity
&retURL=%2F{!Contact.Id}
&accid={!Account.Id}
&opp3={!Contact.Name} - Donation {!YEAR( TODAY() )}
&opp9={!TODAY()}
&opp11=Prospect ID
When the button is used it defaults to the master Record Type, but I want to design the button so it prompts the user to select the Record Type from a subset of types.
Any suggestions ideas are welcome. At a minimum I would like to at least have the user prompted to select any of the current record types.
- Lynn the AFTD SysAdmin
- November 12, 2015
- Like
- 0
- Continue reading or reply
Attempting to schedule a batch Apex on Opportunities without results
I have written the following piece of batch apex code to be run nightly (using a scheduable class call). I have tested all the stage and date conditions seperately, but I cannot seem to get the class to work. I get no error messages on compilation or run time, but nothing ever happens (the calls for follow-up or email alert aren't invoked). I am drawing a blank an have stared at the code for too long, any help would be appreciated!
Cheers!
global class UpdateOppstoDormant implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext BC){
String query = 'SELECT Id, StageName, CloseDate, NextActivityDate__c, LastActivityDate FROM Opportunity WHERE StageName !=\''+String.escapeSingleQuotes('Received')+'\'';
return Database.getQueryLocator(query);
} //end query
global void execute(Database.BatchableContext BC, List<Opportunity> scope){
List<ID> DormantProspectIDs = New List<ID>();
List<ID> DormantRenewalIDs = New List<ID>();
for(sObject s : scope){
Opportunity o = (Opportunity)s;
//check if opportunities are prospects
if(o.Stagename == 'Prospect ID' || o.Stagename == 'Prospect Engaged'){
// check activity dates to establish Prospect dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 30) &&
(date.today().daysBetween(o.CloseDate) < 180) &&
(o.NextActivityDate__c == NULL || o.NextActivityDate__c < date.today()) ){
DormantProspectIDs.add(o.ID);
} //end activity date check
} //end dormant prospects
//check if opportunities are renewals
if(o.StageName == 'Renewal Potential' || o.StageName == 'Renewal Likely'){
// check activity dates to establish Renewal dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 90) &&
(o.NextActivityDate__c == NULL || date.today().daysBetween(o.NextActivityDate__c) > 90) ){
DormantRenewalIDs.add(o.ID);
} //end activity date check
} //end dormant Renewals
}
//for Dormant Prospects
List<Opportunity> DormantProspects = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantProspectIDs];
InactiveOpp.NewFollowUpTask(DormantProspects);
InactiveOpp.OwnerEmailAllert(DormantProspects);
//for Dormant Renewals
List<Opportunity> DormantRenewals = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantRenewalIDs];
InactiveOpp.RenewalFolloUpTask(DormantRenewals);
InactiveOpp.PotentialRenewalDomantAllert(DormantRenewals);
} //end execute
global void finish(Database.BatchableContext BC){
} //end finish
} //end class
Cheers!
global class UpdateOppstoDormant implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext BC){
String query = 'SELECT Id, StageName, CloseDate, NextActivityDate__c, LastActivityDate FROM Opportunity WHERE StageName !=\''+String.escapeSingleQuotes('Received')+'\'';
return Database.getQueryLocator(query);
} //end query
global void execute(Database.BatchableContext BC, List<Opportunity> scope){
List<ID> DormantProspectIDs = New List<ID>();
List<ID> DormantRenewalIDs = New List<ID>();
for(sObject s : scope){
Opportunity o = (Opportunity)s;
//check if opportunities are prospects
if(o.Stagename == 'Prospect ID' || o.Stagename == 'Prospect Engaged'){
// check activity dates to establish Prospect dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 30) &&
(date.today().daysBetween(o.CloseDate) < 180) &&
(o.NextActivityDate__c == NULL || o.NextActivityDate__c < date.today()) ){
DormantProspectIDs.add(o.ID);
} //end activity date check
} //end dormant prospects
//check if opportunities are renewals
if(o.StageName == 'Renewal Potential' || o.StageName == 'Renewal Likely'){
// check activity dates to establish Renewal dormancy
if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 90) &&
(o.NextActivityDate__c == NULL || date.today().daysBetween(o.NextActivityDate__c) > 90) ){
DormantRenewalIDs.add(o.ID);
} //end activity date check
} //end dormant Renewals
}
//for Dormant Prospects
List<Opportunity> DormantProspects = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantProspectIDs];
InactiveOpp.NewFollowUpTask(DormantProspects);
InactiveOpp.OwnerEmailAllert(DormantProspects);
//for Dormant Renewals
List<Opportunity> DormantRenewals = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantRenewalIDs];
InactiveOpp.RenewalFolloUpTask(DormantRenewals);
InactiveOpp.PotentialRenewalDomantAllert(DormantRenewals);
} //end execute
global void finish(Database.BatchableContext BC){
} //end finish
} //end class
- Lynn the AFTD SysAdmin
- October 28, 2015
- Like
- 0
- Continue reading or reply