• Justin Cairns 14
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Email Pop out Window from Sales Console
I have a custom button on the contact page that I would like to open a new window.  I can get it to work in the normal view but when I'm in a console view it opens inside of the console.  Is there a way to get it to open a new window outside of the console view?  

Here are the details:  
Custom Button on the contact object. 
Display Type = Detail Page Button
Behavior = Execute JavaScript
Content Source = OnClick JavaScript

Here's the part I can't get to work.  Wanting it to open in a new popup window if the button is clicked in the console view.  Currently it opens the standard email screen in the console view.  

{if(inIframe())
{window.open("/_ui/core/email/author/EmailAuthor?p3_lkid={!Account.Id}&retURL=%{!Account.Id}&p24={!Contact.Email}&template_id={!$Label.TAFS_CS_Default_Email_Template_ID}&p3_lkid={!Account.Id}&p3={!URLENCODE(Account.Name)}","Popup","location=1, status=no, resizable=no, directories=no, toolbar=yes, width=1200, height=700")}
Is there a way to write logic that can determine if a value starts with any alpha character or any numeric character?  Example would be we want to know if a string begins with an 2 alpha characters.  Or we want to know if it begins with any 3 numeric values.  Or a combination.  

@@#####  So this would indicate the string should start with any 2 alpha and then have 5 numeric.  This will be used in an APEX batch process uses a rules table to determine if records meet one of the defined criteria.  So we would need a way to define the mapping and then a way to check it in APEX.  Any help would be appreciated.  Thanks.  
I am creating a trigger that will call code to count contacts at the account level meeting certain criteria.  It's working for Adds and Updates, but when I delete a contact the trigger is not updating anything.  Here is the trigger.  Do I need to place the isDelete somewhere else so that it will use the current values instead of the values before the action?  

trigger TAFS_Contact_Trigger on Contact(after insert, after update, after delete){
    if(Trigger.isAfter){
        if(Trigger.isInsert){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.new);
        }
        if(Trigger.isDelete){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.old);
        }
        if(Trigger.isUpdate){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.new);
        }
    }
I'm trying to create a trigger that will Sum Contacts at the Account Level when the Contact Type = Owner.  I want to take that number increate it by 1 and add an 's' to the front of it and populate it on an Account Level Field called TAFS_General_Manager_tag__c.  

The problem I'm having is comparing the string field to the integer in my trigger.  How can I create an integer to use in the trigger?  My trigger is listed below.  So the end result I want to place in the TAFS_General_Manager_tag__c will be 's' + (sum of contacts with a type of Owner +1)



trigger ContactSumTrigger on Contact (after delete, after insert, after undelete, 
after update) {

    Contact[] cons;
    if (Trigger.isDelete) 
        cons = Trigger.old;
    else
        cons = Trigger.new;

    // get list of accounts
    Set<ID> acctIds = new Set<ID>();
    for (Contact con : cons) {
            acctIds.add(con.AccountId);
    }
    
    Map<ID, Contact> contactsForAccounts = new Map<ID, Contact>([select Id
                                                            ,AccountId
                                                            from Contact
                                                            where AccountId in :acctIds and TAFS_Contact_Type__c = 'Owner']);

    Map<ID, Account> acctsToUpdate = new Map<ID, Account>([select Id
                                                                 ,TAFS_General_Manager_tag__c
                                                                  from Account
                                                                  where Id in :acctIds]);
                                                                 
    for (Account acct : acctsToUpdate.values()) {
        Set<ID> conIds = new Set<ID>();
        for (Contact con : contactsForAccounts.values()) {
            if (con.AccountId == acct.Id)
                conIds.add(con.Id);
        }
        if (acct.TAFS_General_Manager_tag__c != conIds.size())
            acct.TAFS_General_Manager_tag__c = 's' + conIds.size();
    }

    update acctsToUpdate.values();

}
Is there a way to write logic that can determine if a value starts with any alpha character or any numeric character?  Example would be we want to know if a string begins with an 2 alpha characters.  Or we want to know if it begins with any 3 numeric values.  Or a combination.  

@@#####  So this would indicate the string should start with any 2 alpha and then have 5 numeric.  This will be used in an APEX batch process uses a rules table to determine if records meet one of the defined criteria.  So we would need a way to define the mapping and then a way to check it in APEX.  Any help would be appreciated.  Thanks.  
I am creating a trigger that will call code to count contacts at the account level meeting certain criteria.  It's working for Adds and Updates, but when I delete a contact the trigger is not updating anything.  Here is the trigger.  Do I need to place the isDelete somewhere else so that it will use the current values instead of the values before the action?  

trigger TAFS_Contact_Trigger on Contact(after insert, after update, after delete){
    if(Trigger.isAfter){
        if(Trigger.isInsert){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.new);
        }
        if(Trigger.isDelete){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.old);
        }
        if(Trigger.isUpdate){
            TAFS_ContactTriggerHandler.contactInsert(Trigger.new);
        }
    }