• ankit284511
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi!

 

I've overridden the "Edit" functionality of a Custom Object with a VF Page which uses Standard Controller with extensions.

 

Now, when this object's records are submitted for approval and locked, I'm still getting my overriden VF Page when clicked on Edit button. Instead, is it possible to retain "Lock Record" functionality by making changes in the extension Classes?

 

Thanks!

Karthik.

Hello Everyone,

I hope you can help me on this..Im working with singleEmail to send an email to a particular sales representative on every territory. but every time I invoked my trigger via update of my objects, it returns an exception. The error is: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.\.: Trigger.Notify_Rep_Trigger: line 90, column 21

my code is written below:

Account territory = [select Territory_Name__c from Account where Id =:data.Account_ID__c];
           
            if(territory.Territory_Name__c != null)
            {
               
                List<string> splitID = territory.Territory_Name__c.split(';', -1);
                Set<string> tID = new Set<string>();
                tID.clear();
               
                List<Territory> territoryId = [Select id From Territory where name in :splitID];
               
                List<UserTerritory> usersId = [Select UserId From UserTerritory where territoryid in :territoryId];
               
                for(integer x=0; x < usersId.size(); x++)
                {
                        tID.add(usersId[x].UserId);
                }
               
                List<User> emailAdd = [select Id, email from User where Id in :tID];
               
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                List <String> Addresses = new List<String>();
           
                for(integer i=0; i < emailAdd.size(); i++)
                {
                    //String[] toAddresses = new String[] {emailAdd[i].email};
       
                    //mail.setToAddresses(toAddresses);
                    mail.setCcAddresses(ccAddresses);
                   
                    mail.setBccSender(true);
                    mail.setUseSignature(false);
                    mail.setSaveAsActivity(false);
                   
                    String toTargetObjects = (string)emailAdd[i].Id;
                   
                    system.debug('target object deb:'+toTargetObjects);
                    system.debug('data id deb:'+data.Id);
                   
                    mail.setTargetObjectId(toTargetObjects);
                    mail.setWhatId(toTargetObjects);
       
                    mail.setTemplateId(templateId);
                   
                    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
                }
            }
        }

any suggestion? I would really appreciate it if you can help me on this.


Thanks in advance,

Wilson




Message Edited by wilson34 on 11-21-2008 01:50 AM

Message Edited by wilson34 on 11-21-2008 01:51 AM

Message Edited by wilson34 on 11-21-2008 01:51 AM

Message Edited by wilson34 on 11-21-2008 01:53 AM
Hey everyone,

I'm trying to build a tree component and am able to go down two levels but I'm not sure how (or if) it would be possible to continue adding levels.


I'm already building the above tree with the following code:
Controller:
public ProjectTask__c [] getTasks()
 {
  return [Select Id, Name, (Select Id, Name from Tasks__r)  from ProjectTask__c where Project__c = :projectId];
 }

 
VF Page:
<ul id ="tree" class="treeview">
 <apex:repeat value="{!tasks}" var="t">
  <li><span class = "file"><a href = "/{!t.id}">{!t.name}</a></span>
   <ul>
    <apex:repeat value="{!t.Tasks__r}" var="st">
     <li><span class = "file"><a href = "/{!st.Id}" />{!st.name}</a></span></li>
    </apex:repeat>
   </ul>
  </li>
 </apex:repeat>
</ul>

 If I have any items below 1.1 or 2.1, such as 1.1.1, 1.1.1.1, etc. what would be the best way to build a list of this nature?

Thanks,
Colin