• Trupti
  • NEWBIE
  • 95 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 24
    Replies
HI All,
 i have a formula field getting avarage of five fields and when a field is blank still it should get the Avarage.
my formula is given below:-
If((VALUE(TEXT(Agency_Health__c))+ VALUE(TEXT(Client_Relationship__c)) + VALUE(TEXT(Renewal__c)) + VALUE(TEXT(Delivery__c)) + VALUE(TEXT(KPI__c))) <= 0,0,(VALUE(TEXT(Agency_Health__c)) + VALUE(TEXT(Client_Relationship__c)) + VALUE(TEXT(Renewal__c)) + VALUE(TEXT(Delivery__c)) + VALUE(TEXT(KPI__c)) )
/
(if(VALUE(TEXT(Agency_Health__c))>0,1,0)+ if(VALUE(TEXT(Client_Relationship__c))>0,1,0)+ if(VALUE(TEXT(Renewal__c))>0,1,0) + if(VALUE(TEXT(Delivery__c)) > 0,1,0) + if(VALUE(TEXT(KPI__c))>0,1,0))
)
how to solve it?
Any suggestions?
Example:
 Case  --  Parent
  A -- - child
  B --- -  child
  C  ---  child

  when i deleting Case  records ,i needs to delete A ,B and C records associate parent Records.
Using apex?

Urgent------------
 

Hi,

whenever account phone is updated i want to update the contact phone field too.
How can we achieve this with triggers..
can you send me the trigger code

Thanks in Advance 

How can i write the validation rule in which on changing value in Opportunity Picklist value it compares the value with 2 picklist fields of custom object .
If value in Opportunity picklist is matches with the any of the 1 field of custom object then it saves record otherwise it throws the error.

I have write the following validation rule but it didn't work.

Kindly help in correcting the validation rule.
TEXT(INCO_Term__c) <> "" && 
OR( 
TEXT(INCO_Term__c) <> TEXT(Account_Sales_Area_TI__r.Inco__c) , 
TEXT(INCO_Term__c) <> TEXT(Account_Sales_Area_TI__r.Incoterms__c) 
)

 
<apex:page standardController="Companies__c" sidebar="false">

  <apex:sectionHeader title="Company Information" help="Help for this page" />
  <apex:form >
  
     <apex:pageBlock title=" cmp Information" tabStyle="Account" >
         
         
           
             <apex:pageBlockButtons > 
                       <apex:commandButton value=" Save " action="{!save}" />
                      <apex:commandButton value=" Cancel " action="{!cancel}" />
               
               
              </apex:pageBlockButtons>
       
              
      
           <apex:pageBlockSection columns="2" >
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company Name" />
                    <apex:inputfield value="{!Companies__c.name}" /> 
                </apex:pageBlockSectionItem>
                
                
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company phone" />
                    <apex:inputText value="{!Companies__c.cmpanies_phone__c}" /> 
                </apex:pageBlockSectionItem>
                
                
          
               
            
                  
          
             
                 
                 
                
               
                 
          
           
               
               
                 
           </apex:pageBlockSection>
                  
                  
                  
                      <!--contact Information-->
                      
                      
                        <apex:pageBlockSection columns="2" title="Contact Information">
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact Person"/>
                    <apex:inputfield value="{!Companies__c.Contact_Person__c}" /> 
                </apex:pageBlockSectionItem>
                
                
             
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact's Email Address" />
                    <apex:inputText value="{!Companies__c.Contact_s_Email_Address__c}" /> 
                </apex:pageBlockSectionItem>
          
               
              
     
               
                 
           </apex:pageBlockSection>
                  
                  
            
           
        
   
           
        
        
       
     
     </apex:pageBlock>
  
  </apex:form>
  
</apex:page>
  i had created a  custom filed and a custom object and i had created a visualforce page, if  i had saved the record ,it is not getting save , may i know the error in that???
  • December 17, 2018
  • Like
  • 0
Hi All, I wrote this Batch code, and is not showing any error and also it is running anonymously, but record is not getting updated

public class fieldupdate1 implements Database.Batchable<SObject>{
    public Database.querylocator start(Database.BatchableContext bc){
        string query = 'select id, name, industry from account';
        return database.getquerylocator(query);
        }

    public void execute(Database.BatchableContext bc, list<Account> scope){
        list<Account> accs = new list<account>();

        for(Account a : scope){
            
            for(integer i=25;i<30;i++){
                if(a.name == 'Test Batch'+i){a.industry='Agriculture';}
            accs.add(a);
            }
            
            }
        update accs;
        }
    
    public void finish(Database.BatchableContext bc){}
    
    }
Hi  
The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
Hi All,

I have one doubt that how can i use includes with the set in soql query.

List<LD_Category_Group_Association__c> allLdCatGrpAsslist = [SELECT Id,User_Groups__c FROM LD_Category_Group_Association__c Where User_Groups__c includes (: set_of_LD_User_Groups) ];

Here , User_Groups__c  is a multiple picklist field
when ever account type is changed form any value to 'Customer' need to 
send an email to account owner saying your account become customer 
and create a task and assign it to account owner.
    class
public B_AsyncContactImport_Mailchimp(String mailChimpListId, Integer members_count, Integer members_offset, Boolean insertDuplicates, Integer saved_members_count, String tagName) {
        this.mailChimpListId = mailChimpListId;
        this.members_count = members_count;
        this.members_offset = members_offset;
        this.insertDuplicates = insertDuplicates;
        this.saved_members_count = saved_members_count; //initially it's zero.
        this.tagName = tagName;
    }
     test class
    @isTest 
    static void test_AsyncContactImport_Mailchimp(){

        Test.startTest(); 
        String listMembersResponse = '{"members":[{"id":"a89d6fa724ea206edb06cd262ce6bf1d","email_address":"user+11@test.com","unique_email_id":"8984312e5e","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"FirstOne","LNAME":"LastOne"},"list_id":"5abcf1f4c5"}],"list_id":"5abcf1f4c5","total_items":1}';
        Test.setMock(HttpCalloutMock.class, new B_HttpCalloutMock(200, 'OK', listMembersResponse, null));
        try {
                B_AsyncContactImport_Mailchimp obj = new B_AsyncContactImport_Mailchimp('5abcf1f4c5',2,3,true,3,'tagName');
                //obj.execute(null);
                System.enqueueJob(obj);
             (new B_AsyncContactImport_Mailchimp('1005',2,3,false,3,null)).execute(null);
            } catch(Exception e) {
                //System.debug('!=== Exception: ' + e.getStackTraceString());
                System.assert(e.getMessage() != null);
            }
        Test.stopTest() ;           
    }
  • December 10, 2018
  • Like
  • 0
Hi All,
Please consider the below scenario.
In salesforce org we have a user (say U1), U1 has created multiple records of the custom object (say O1), the object O1 has private OWD and U1 is the topmost role in the role hierarchy.
Now U1 has left the org due to some reasons, and the user is deactivated by the System Admin.
Do we have any way that we can see the records of the object O1 created by the user U1 ?
Thanks in Advance...
HI All,
 i have a formula field getting avarage of five fields and when a field is blank still it should get the Avarage.
my formula is given below:-
If((VALUE(TEXT(Agency_Health__c))+ VALUE(TEXT(Client_Relationship__c)) + VALUE(TEXT(Renewal__c)) + VALUE(TEXT(Delivery__c)) + VALUE(TEXT(KPI__c))) <= 0,0,(VALUE(TEXT(Agency_Health__c)) + VALUE(TEXT(Client_Relationship__c)) + VALUE(TEXT(Renewal__c)) + VALUE(TEXT(Delivery__c)) + VALUE(TEXT(KPI__c)) )
/
(if(VALUE(TEXT(Agency_Health__c))>0,1,0)+ if(VALUE(TEXT(Client_Relationship__c))>0,1,0)+ if(VALUE(TEXT(Renewal__c))>0,1,0) + if(VALUE(TEXT(Delivery__c)) > 0,1,0) + if(VALUE(TEXT(KPI__c))>0,1,0))
)
how to solve it?
Any suggestions?
Hi All, Good Day! I want to run batch apex on a list of records provided. I don't want to  have run any SOQL in start() method. How to achieve this?
Hi, 
we have a VF page, which using action in the page tab, since the action is very slow. we would like to put spinnning image. we tried the ationstatus solution. it works for click a button. but in our case, we don't have any button in the page at all. the spinning image is not showing.

Any ideas?
Hi,

I have the below trigger, where I intend to update the Account record if the linked opportunity has been staged to "Qualification".

trigger mapAccount on Opportunity (before insert,before update) {
    
    List<Opportunity> ol=[select id,Account.rating from Opportunity where id in: Trigger.new and StageName='Qualification'];
    Map<ID,Opportunity> mp=new Map<ID,Opportunity>();
    System.debug('----------');
    
    for(Opportunity o:ol){
        o.Account.rating='Cold';
        mp.put(o.id, o);
        System.debug('Rate--'+o.Account.rating);
    }
    System.debug(mp.values());
}


But, Using this, the account Rating is not getting updated. Please explain the reason.

Thanks in Advance !

Hi Friends,

 

I need to know how to the query the records from custom label object. Is it possible to query the data from this object? As we do the same from other objects like Account, Contact, ......

We can use labels in our controller, like Label.<Label_Name>.

 

while i am trying to query the data from customLabel, it is throwing error like :

 

"line 1, column 20: sObject type 'CustomLabel' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

 

Please help me in this, how to use this object in apex controller.

 

Thanks in advance.

 

Regards,

Phanikumar