• Raji
  • NEWBIE
  • 75 Points
  • Member since 2011

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 17
    Replies
2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   



I've a update trigger on a custome object.Does trigger works when the fomula field of the object update?

I'm looking for the reply.

any suggestion would be appreciated.

thanks

  • August 16, 2011
  • Like
  • 0
2.2.Impacts to Call Visit                           
    The Call Activity object will be added with a new formula field called Channel            
    The formula of this field is based on the value of the Account object's Channel field with a look up on the Account 
    Example, if the Account has a Channel = Doctor then the corre3sponding Call Activity will have the value of Doctor 



i wrote the batch apex code i.e,

global class batchOrphanedContacts implements Database.Batchable<sObject>,schedulable {
	global string strQuery;
	 
    global void execute(schedulablecontext sc){
       batchOrphanedContacts bc= new batchOrphanedContacts();
       database.executebatch(bc);
    }
    
    global Database.QueryLocator start(Database.BatchableContext bc){
    	string Cname='TestFound Contact';
        return Database.getQueryLocator('select Id,lastname,AccountId,owner.email from Contact where name=:Cname  ');   
    }           
 
    global void execute(Database.BatchableContext bc,List<Contact> lstCon){
          string MesgBody;
          string[] Email;
          list<OpportunityContactRole> lstOPPConrole;
          list<Contact> lstUpdateContact=new list<Contact>();
          Contact objCon;
          map<Id,Integer> mapConCount = new map<Id,Integer>();
          map<Id,Contact> mapContacts=new map<Id,Contact>();
          map<Id,Id> mapConAccount = new map<Id,Id>();
                   
          for(Contact objContact:lstCon)
              mapContacts.put(objContact.id,objContact);
              
          lstOPPConRole=[select id,ContactId,OpportunityId,Opportunity.AccountId from OpportunityContactRole where ContactId in: mapContacts.keyset() order by ContactId];
           
           if(lstOPPConRole != null && !lstOPPConRole.isEmpty()){
            for(OpportunityContactRole oppConRole : lstOppConRole){
                if(mapConCount.get(oppConRole.ContactId) != null){
                    if(mapConAccount.get(oppConRole.ContactId) != OppConRole.Opportunity.AccountId)
                        mapConCount.put(oppConRole.ContactId,(mapConCount.get(oppConRole.ContactId)+1));    
                }
                else{
                    mapConCount.put(oppConRole.ContactId,1);
                    mapConAccount.put(oppConRole.ContactId,OppConRole.Opportunity.AccountId);       
                }
            }   
           }
           
            for(Integer iCount=0;iCount<mapContacts.values().size();iCount++){
                objCon = mapContacts.values()[iCount];
                MesgBody = '';
                if(mapConCount.get(objCon.id) != null){
                    if(mapConCount.get(objCon.id) == 1){
                        objCon.accountId = mapConAccount.get(objCon.id);
                        //Found
                         MesgBody = 'Account found for the Contact '+ '\r\r\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + objcon.id;
                         Email=new string[]{objcon.owner.email};
                         lstUpdateContact.add(objCon);
                    }else if(mapConCount.get(objCon.id)>1){
                        //Many  
                        MesgBody = 'Too many Accounts found for the Contact'+ '\r\r\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + objcon.id;
                        Email=new string[]{objcon.owner.email};
                    }   
                }
                else{
                    //Not Found
                    MesgBody = 'No Accounts found for the Contact'+ '\r\r\n' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + objcon.id;
                    email=new string[]{objcon.owner.email};
                } 
                
                if(MesgBody != ''){
                	if(sendMail(MesgBody,Email) == false){
                		break;		
                	}	
                }
            }
        update lstUpdateContact;
     }
    //send Email 
    public boolean sendMail(string body,string[] toAddresses ) {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setSubject('Review Orphaned Contact');
        email.setToAddresses( toAddresses );
        email.setPlainTextBody( body );     
        try{
          Messaging.SendEmailResult [] r =Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
          return true;	
        }catch(Exception ex){
          return false;  
        }  
    }
     
    global void finish(Database.BatchableContext bc){      
       system.debug('all done.');   
    }
}

 i need to stop sending  mails after Completing 1000 mails for a day . please help me 

. Advance thanks

 

Regards

VN

  • July 18, 2011
  • Like
  • 0

On the Contact new / edit screen, when you lookup an Account, the Address firelds from the Account are filled into the Contact address fields on the screen.

 

I've now added a custom field to Account and Contact objects called "Building Name" - does anyone know of a way to get the new field to auto-populate on the Contact screen as well ?

Anyone done something similar?

 

 

Thanks.

Hi all,

 

I am trying to develop a dashboard from source summary report on 'account object ' summarized on 'annual revenue' field and grouped by  a custom field 'CCAS' but I am getting the following error.

 

'All vaues are negative or Zero.Pie,donut,funnel and stacked charts require at least one positive value to display'

 

 

Please help me understand what might be the reason of this error ?

 

Thanks in advance

 

  • August 19, 2011
  • Like
  • 0

Is there a way to show the Territory.Name field and the User.Firstname, User.LastName via SOQL?

 

I tried the following code, but it doesn't seem to work. Thanks in advance for any help.

 

SELECT TerritoryId.Name, UserId.FirstName,UserId.LastName FROM UserTerritory

 

Hi  to all,

 

I unable to trim the String data while taking in to visualforce page .

 

Eg :

1-a 

11-a

111-a

 

I have to trim the values up to Hyphon i.e., i have to remove {(1-)(11-)(111-)} and  i have to display {(a)(a)(a)}

 

   

<apex:outputText value="{0,trim('-')}">         <apex:param value="{!time}" />    </apex:outputText>

 

But i am getting error as :

 

The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

 

Can any one help on this.

Hi,

 

Can any one give a sample example to use whoid and whatid functionality for task object?

please tell me where & when we use whoId and whatId?

I have an custom object   which has more than 1000 records in it. Able to retrieve only 1000 records above that it is throwing an error... How to retrieve more than 1000 records on a single soql query?

  • August 16, 2011
  • Like
  • 0
2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   



I've a update trigger on a custome object.Does trigger works when the fomula field of the object update?

I'm looking for the reply.

any suggestion would be appreciated.

thanks

  • August 16, 2011
  • Like
  • 0
2.2.Impacts to Call Visit                           
    The Call Activity object will be added with a new formula field called Channel            
    The formula of this field is based on the value of the Account object's Channel field with a look up on the Account 
    Example, if the Account has a Channel = Doctor then the corre3sponding Call Activity will have the value of Doctor 



Hi

 

I have one requirement that using visual force page have to upload video in to salesforce database ,  please help me to get out of this requirement and its very urgent.

 

 

Regards,

Praveen S

Hi

 

<apex:page standardStylesheets="false" expires="1" cache="false" showHeader="false" sidebar="false" id="page" controller="contacts">

  <style type="text/css">
body {
    font-size: 62.5%;
}
label {
    display: inline-block;
    width: 100px;
}
legend {
    padding: 0.5em;
    margin-left:auto;
    margin-right:auto;
}
fieldset fieldset label {
    display: block;
}
#signUpForm {
    width: 500px;
    margin-left:auto;
    margin-right:auto;
    margin-top:25px;
}
#signUpForm label {
    width: 250px;
}
#signUpForm label.error, #commentForm button.submit {
    margin-left: 253px;
}
#signUpForm {
    width: 670px;
}
#signUpForm label.error {
    margin-left: 250px;
    width: auto;
    display: block;
}
</style>
  <form class="cmxform"  id="signUpForm" >
    <fieldset class="ui-widget ui-widget-content ui-corner-all">
      <p>
        <label>Firstname</label>
        <input name="Firstname" id="Firstname" type="text" maxlegth="15" size="60" class="required"  />
      </p>
      <p>
        <label>Last Name</label>
        <input name="Lastname" id="Lastname" type="text" size="60"  class="required" />
      </p>
      <p>
        <input type="button" onClick="signUp();" value="Create Account" class="button" />
      </p>
    </fieldset>
  </form>

</apex:page>

 

I want to Add record in Account . Pls help me how to write Controller for this . Seconly is this can be done through Java Remoting if yes then how .

 

Thanks

I am trying to use Dynamic Field Binding with in a datatable.

 

I want to send a List of Tasks from a query to a datatable to be rendered, but be able to add columns to the table using a fieldset defined in Task Field Sets.

 

Here is my code:

 

<apex:dataTable cellspacing="2" value="{!Tasks}" var="ta" rendered="{!HasActivities}" id="Results3" rowClasses="odd,even">
        <apex:column headerValue=""><apex:outputLink value="/{!ta.Id}" target="_blank">View</apex:outputLink></apex:column>
        <apex:column headerValue=""><apex:outputLink value="/{!ta.Id}/e?" target="_blank">Edit</apex:outputLink></apex:column>

        <apex:repeat value="{!$ObjectType.Task.FieldSets.TaskMassEditFieldSet}" var="f">
              <apex:column headerValue=""><apex:inputField value="{!ta.[f]}" /></apex:column>
        </apex:repeat>
</apex:dataTable>

 

!Tasks is my list of Tasks.

 

When I try to save the page I get an "Invalid field for SObject Task" Error


 

Is this possible?

 

Thanks in advance for any help.