• darreln
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies
Hello all,
I currently have the following logic in a workflow rule to determine when to send out an email alert:

AND ( 
RecordTypeId <> "012C0000000CCTo", 
ISCHANGED ( Requested_Dev_Date__c ), 

OR 
(ISPICKVAL (StageName , "6.5 Process with Signature" ), 
(ISPICKVAL (StageName , "6.3 Process without Signature" )) 
)))

I now have a need to test for more than one record type ID, while the rest of the logic would stay the same. How do I best accomplish this code? Is the right approach a CASE statement, or IF? How would this be structured?
 
Hello,
I have received great help with a trigger that displays a warning message when the "public" checkbox is not checked on the creation of a new task with a specific record type (contact object). Upon trying to deploy this, I ran in to the "No code coverage" message, and subsquently learned that a test class mus be written and the trigger must be tested before a deployment is possible. 

I am not a programmer, really not sure how I would tackle this. I am hopeful that someone here can help me with a test class for this trigger? I would really apprecaite it! Trigger follows:


trigger PublicFORBRYANTHC on Task (after insert,after Update) {
    Set<Id> ids=new Set<Id>();
    Set<Id> Conids=new Set<Id>();

    for(Task t:trigger.new){

    ids.add(t.id);
        if(t.WhoId != null && (((String)t.WhoId).substring(0,3) == '003') ) {
        conIds.add(t.WhoId);
        }
    }
    List<Contact> con=[Select id from contact where id in:conIds and RecordTypeId in (SELECT Id FROM RecordType WHERE Name = 'Bryant HC')];

    for(Task t:trigger.new){

        if(t.IsVisibleInSelfService<> true && con.size()>0 ) {

                    t.AddError('Public Checkbox must be checked!');

        }

    }

}
 
Hello all,

been doing some research, and understand that I cannot directly reference a contact or account record type from the task object. Here is my need:

I created a new record type for the contact object, let's call it ABC. Anytime a user creates a activity of type 'task' where the Parent object is a contact and the record type is ABC, I want to make sure the user clicks the "Public" checkbox on the task record when he/she saves the record. 

I was thinking either show an error if it's not checked, or simply set the checkbox to TRUE when the record is saved, regardless of whether the user remembered or not. 

From what I understand, this will require a trigger to be written. Looking for some help / sample trigger code that would get me there, as I am not a programmer :|

thank you!
 
Hello all,
I currently have the following logic in a workflow rule to determine when to send out an email alert:

AND ( 
RecordTypeId <> "012C0000000CCTo", 
ISCHANGED ( Requested_Dev_Date__c ), 

OR 
(ISPICKVAL (StageName , "6.5 Process with Signature" ), 
(ISPICKVAL (StageName , "6.3 Process without Signature" )) 
)))

I now have a need to test for more than one record type ID, while the rest of the logic would stay the same. How do I best accomplish this code? Is the right approach a CASE statement, or IF? How would this be structured?
 
Hello,
I have received great help with a trigger that displays a warning message when the "public" checkbox is not checked on the creation of a new task with a specific record type (contact object). Upon trying to deploy this, I ran in to the "No code coverage" message, and subsquently learned that a test class mus be written and the trigger must be tested before a deployment is possible. 

I am not a programmer, really not sure how I would tackle this. I am hopeful that someone here can help me with a test class for this trigger? I would really apprecaite it! Trigger follows:


trigger PublicFORBRYANTHC on Task (after insert,after Update) {
    Set<Id> ids=new Set<Id>();
    Set<Id> Conids=new Set<Id>();

    for(Task t:trigger.new){

    ids.add(t.id);
        if(t.WhoId != null && (((String)t.WhoId).substring(0,3) == '003') ) {
        conIds.add(t.WhoId);
        }
    }
    List<Contact> con=[Select id from contact where id in:conIds and RecordTypeId in (SELECT Id FROM RecordType WHERE Name = 'Bryant HC')];

    for(Task t:trigger.new){

        if(t.IsVisibleInSelfService<> true && con.size()>0 ) {

                    t.AddError('Public Checkbox must be checked!');

        }

    }

}
 
Hello all,

been doing some research, and understand that I cannot directly reference a contact or account record type from the task object. Here is my need:

I created a new record type for the contact object, let's call it ABC. Anytime a user creates a activity of type 'task' where the Parent object is a contact and the record type is ABC, I want to make sure the user clicks the "Public" checkbox on the task record when he/she saves the record. 

I was thinking either show an error if it's not checked, or simply set the checkbox to TRUE when the record is saved, regardless of whether the user remembered or not. 

From what I understand, this will require a trigger to be written. Looking for some help / sample trigger code that would get me there, as I am not a programmer :|

thank you!