• Ketankumar Patel
  • SMARTIE
  • 592 Points
  • Member since 2015
  • Architect - Business Applications
  • Wind River Systems Inc


  • Chatter
    Feed
  • 17
    Best Answers
  • 0
    Likes Received
  • 7
    Likes Given
  • 2
    Questions
  • 135
    Replies
I have a formula field that averages survey responses and excludes null values. How can I prevent from dividing by 0 if all the responses are null? (If the second part of this formula = 0)

(IF(ISBLANK(CS1_Q1_answer__c),0,CS1_Q1_answer__c)+
IF(ISBLANK(CS1_Q2_answer__c),0,CS1_Q2_answer__c)+
IF(ISBLANK(CS1_Q3_answer__c),0,CS1_Q3_answer__c)+
IF(ISBLANK(CS1_Q4_answer__c),0,CS1_Q4_answer__c))

/

(IF(ISBLANK(CS1_Q1_answer__c),0,1)+
IF(ISBLANK(CS1_Q2_answer__c),0,1)+
IF(ISBLANK(CS1_Q3_answer__c),0,1)+
IF(ISBLANK(CS1_Q4_answer__c),0,1))
I wan to write trigger in such a way that when ever a new lead is created, with the same name i want to create another lead... In short.. I want to create the clone of lead... when new lead is getting created... plz help..
I have a process builder that is creating detail records and populating a few fields on creation. I also have an after insert trigger that is firing based on one of the fields that is populated during the record creation in the process builder.  Both function perfectly independently but when a record is created through the process builder that should fire the trigger it does not.  Any ideas or resources would be greatly appreciated since I'm new to triggers?
I have two custome fields in my opportunity. right now the fields are being field manually. one filed is a checkbox, and what I want is as soon as an that check mark is checked, the name of the person that has checked it to be in another field under it . So I have Check1__c being checked, 

and I have NameUpdate__c to be field up by my name since I am workign on this opportunity right now
Greetings I am looking to create a fromula field that populates data according to these two if statements for my opportunity field. This field will be referenced a mail merge document. Basically if the account and contact full name don't match and the contact/donor record type is not in individual, then a text result will populate as this is a person account, otherwise, it will just say dear so and so.

IF(Account.Name <> Contact.Full_Name__c) and IF(Donor_Type__c !="Individual") then Product_Donations_Summary__c = "Greetings from Us", Dear+Contact.First_Name__c

Hope it helps.

Hi

We have a custom lookup field that has been created on the Opportunity Line Item object called Product Owner. We would like this to be auto populated with the current user when left blank upon saving. 

We've tried to create a trigger to do this but run into errors upon saving the product line

trigger updatefield on OpportunityLineItem (after insert) {
  user defaultuser = [select id from user where name = 'default user'];
  for (OpportunityLineItem record:trigger.new) {
    if(record.Product_Owner__c ==null) {
      record.Product_Owner__c = defaultuser.id;
    }
  }
}

Any help or advice would be much appreciated.

Thanks,

Snita

Hi to all,

I am trying to pre-populate Ownerid on a new Lead based on a dropdown menu. But it doesnt work. Any ideas?

User-added image
Our Org has both workflow rules and one specific ProcessBuilder Rule that kick off upon Account creation. Today, I attempted to use APEX DataLoader to import a small list of new accounts into the system. Even though all mandatory fields were populated, each new record failed to import. The following is the error that was returned:

"ERROR: The record couldn't be saved because it failed to trigger a flow.
A flow trigger failed to execute the flow with version ID 30131000000LWaa.
Contact your administrator for help."

When I used the exact same fields to manually create one account record there were no problems.

Based on the error, I figured that the error had something to do with my ProcessBuilder rule. This rule is very simple. On account creation, a default is populated for a custom SCM lookup "PO Payment Terms" field. When I deactivated this rule and ran the Data Loader, the accounts were iported without a problem, but because the rule was deactivated I had to manually set the default for the SCM field.

I cannot use workflows for this rule because I cannot update an SCM Lookup field on the account record. Any idea why I am seeing this error for this simple ProcessBuilder rule?
Hi,
This is my scenario. We have web to leads set up with two different types of leads. Quoted & Purchased.
A person can quote any no. of times and those leads get in to SF as 'Quoted Leads'. To note: All these quoted leads have same email ID as it is the same person quoting, let us say he quoted 3 times. We have 3 quoted leads.
Now, that same person purchased another quote and it is 'purchased lead' in SF. Now, How can I look up at all his quoted leads and mark them as Purchased to true..by searching based of of his email address? I tried this using process builder, but there is a difficulty in looking at all the leads. It is working only on that particular Lead, not looking at all the other leads by looking at the email address. Need help. thank you
Ok so i have read other entries but nothing i take seems to be working so hopefully someone can look at my code and see what the issue is. Im getting these emails raipdly these days and even when going to clean up data im starting to see if on new records as well.

PrimaryAddressValidation: execution of BeforeUpdate

 

caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.

Even if a field is indexed a filter might still not be selective when:

1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

 

Trigger.PrimaryAddressValidation: line 55, column 1

and this is my code the error is coming in at the fist List select statment in each if statement below.
 
// section makes sure that only one checkbox is true within the related address list for the contact
      if(!contactIdsForShipping.isEmpty())
      {
          List<ShipTo_Address__c> toggleShippings = shipToExcluded.isEmpty()?
             [SELECT Id, Default_Shipping_Address__c FROM ShipTo_Address__c WHERE Contact__c IN :contactIdsForShipping AND Default_Shipping_Address__c=true]
             : [SELECT Id, Default_Shipping_Address__c FROM ShipTo_Address__c WHERE Contact__c IN :contactIdsForShipping AND Default_Shipping_Address__c=true AND Id NOT IN :shipToExcluded];

          for(ShipTo_Address__c a : toggleShippings)
          {
                  a.Default_Shipping_Address__c = false;
          }
          update toggleShippings;
      }

      if(!contactIdsForBilling.isEmpty())
          {
              List<ShipTo_Address__c> toggleBilling = billToExcluded.isEmpty()?
              [SELECT Id, Primary_Billing_Address__c FROM ShipTo_Address__c WHERE Contact__c IN :contactIdsForBilling AND Primary_Billing_Address__c=true]
              :[SELECT Id, Primary_Billing_Address__c FROM ShipTo_Address__c WHERE Contact__c IN :contactIdsForBilling AND Primary_Billing_Address__c=true AND Id NOT IN :billToExcluded];
              for(ShipTo_Address__c a : toggleBilling)
              {
                  a.Primary_Billing_Address__c = false;
              }
              update toggleBilling;
          }   

    }

 
Dear Folks,

I would like to update a record, after it's inserted. but I encountered bellow error.. Please help me.

Error: Parthiv.Product: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Class.Parthiv.PromoProd.Crnt_Status: line 10, column 1

Trigger:
trigger Product on Parthiv__PromoProduct__c (after insert, after update) {

if(Trigger.isAfter){
    if(Trigger.isupdate){
        PromoProd.Crnt_Status(Trigger.old);        
      }
    }
}

-------------------------------------------------------------------------------------------------------------------------------------
Class:

public with sharing class PromoProd {
    
//Product current Status Update based on New Status
    public static void Crnt_Status(list<Parthiv__PromoProduct__c>PP){
        
        list<Parthiv__PromoProduct__c> p = new list<Parthiv__PromoProduct__c>();

        
        for(Parthiv__PromoProduct__c prod:pp){
            prod.Parthiv__Cur_Status__c = prod.Parthiv__New_Status__c;
            p.add(prod);
        } update p;
    }    

}
I am receing a #Error in many of my formula fields that were working properly for moths until the last two days. I then received a bunch of unknow field update errors. I deactivated the workflow, now I am getting errors on formula fields when one of the fields referenced in the formula is left blank. As stated this was not happening before. I have many fields that this is happening to. I tested the formula and treid both 'Blank field handling options'. Can someone help?
Hi All, 

I was trying to resolve a defect that is currently allowing sales users to change the opportunity stage after the Opportunity Stage = Closed Won.
For this I followed these steps below:

1) Created "Read Only Page layout" - Read only (to hide the (edit/ delete) buttons for sales reps)
2) Created one record type to assign the Read Only Page layout
3) Created one WFR - with field update action as follows:
User-added image

Now, it resolves the defect which I had earlier. Although this record type works to limit editing for the sales reps, the issue now becomes that I cannot change or revert it back to its original Record Type and we report off of Record Types. 

User-added image

When I click on "Change", it gives me the option to select the Record Type from the picklist. However, after I save the record and scroll down to the System Information, the Opportunity Record Type is still the same - Read Only Recordtype.

It is an urgent need to resolve this issue. Please suggest how to fix this? Thanks.
Update a custom field on Account object if the account has any chid records using triggers.  I am trying to update the parent account record if the account has any child accounts.  The scenario is when a new account is created , it does not have any child accoounts.  We have some reporting that is built based on a flag field which looks for accounts if it has child accounts and we would like to set a flag on the parent account if a child exists.  I wrote the following trigger but it sets the child account field value and not the parent accoount field value.


trigger updateAccountChildFlag on Account(after insert, after update) {  
    if (trigger.isUpdate) {
        //Identify Child Account
        Set<Id> setAccountChangedIds = new Set<Id>();
        for (Account oAccount : trigger.new) {
            Account oOldAccount = trigger.oldMap.get(oAccount.Id);
            if (oAccount.ChildExists__c == false ) {
                setAccountChangedIds .add(oAccount.Id);
            }
        }
        //If any, get child account associated with each account
        if (setAccountChangedIds.isEmpty() == false) {
            List<Account> listChildAccounts = [SELECT Id, ParentId FROM Account WHERE ParentId IN :setAccountChangedIds];
            for (Account oAccount1 : listChildAccounts) {
                //Get Accounts
            //    oAccount = trigger.newMap.get(oAccount1.Id);
                //Set Address
                oAccount1.ChildExists__c = true;
            }
            //If any, execute DML command to save contact addresses
            if (listChildAccounts.isEmpty() == false) {
                update listChildAccounts;
            }
        }
    }
}

The intent is to update current active account record by looping through all accounts to see if the parent account has child based on parent id field.  if the result set is not empty then set a flag field indicating that the child account exists.
I am getting a Syntax error that says there is an extra comma at the end of the second row in the formula below
I need the formula to check if the first two fields are blank and if they are, use the first solution, otherwise use the second.

IF((AND
   (ISBLANK(Date_Decisioned__c ))),(ISBLANK(Returned_to_Sales_for_Credit_Follow_up__c))),
(TODAY() - (DATEVALUE(Submitted_to_Credit__c))),
(DATEVALUE( Returned_to_Sales_for_Credit_Follow_up__c ))-(DATEVALUE(Submitted_to_Credit__c )))
It's strange I followed the salesforce document but I am getting error on validating lightning input field. 

Here is my code.

CustomErrorHandling.cmp
<aura:component>
    
      <lightning:input aura:id="inputCmp"
                           label="Please Enter a Number"
                           name="inputCmp" /><br/>
    <lightning:button label="Submit" onclick="{!c.doAction}"/>
</aura:component>
CustomErrorHandling.js
({
	/*errorHandlingCustomController.js*/

    doAction : function(component, event) {
        var inputCmp = component.find("inputCmp");
        var value = inputCmp.get("v.value");

        // is input numeric?
        if (isNaN(value)) {
            inputCmp.set("v.errors", [{message:"Input not a number: " + value}]);
        } else {
            inputCmp.set("v.errors", null);
        }
    },

    handleError: function(component, event){
        /* do any custom error handling
         * logic desired here */
        // get v.errors, which is an Object[]
        var errorsArr  = event.getParam("errors");
        for (var i = 0; i < errorsArr.length; i++) {
            console.log("error " + i + ": " + JSON.stringify(errorsArr[i]));
        }
    },

    handleClearError: function(component, event) {
        /* do any custom error handling
         * logic desired here */
    }
})

When I click submit button I get below error.

User-added image

Please correct me if I any mistake in my code. you help is much appreciated.
Hi guys, 

I am trying to deploy Lightning Page (FlexiPage) to another sandbox environment using ANT. I also included all profiles with it and deployed it successfully but somehow lightning page did not auto activate in the sandbox. I can see that page in App Builder but when I open a record in lightning I don't see that page is applied to the record. 

Am I missing anything to include in deployment? Did anyone get this issue before? your help is much appreciated.
It's strange I followed the salesforce document but I am getting error on validating lightning input field. 

Here is my code.

CustomErrorHandling.cmp
<aura:component>
    
      <lightning:input aura:id="inputCmp"
                           label="Please Enter a Number"
                           name="inputCmp" /><br/>
    <lightning:button label="Submit" onclick="{!c.doAction}"/>
</aura:component>
CustomErrorHandling.js
({
	/*errorHandlingCustomController.js*/

    doAction : function(component, event) {
        var inputCmp = component.find("inputCmp");
        var value = inputCmp.get("v.value");

        // is input numeric?
        if (isNaN(value)) {
            inputCmp.set("v.errors", [{message:"Input not a number: " + value}]);
        } else {
            inputCmp.set("v.errors", null);
        }
    },

    handleError: function(component, event){
        /* do any custom error handling
         * logic desired here */
        // get v.errors, which is an Object[]
        var errorsArr  = event.getParam("errors");
        for (var i = 0; i < errorsArr.length; i++) {
            console.log("error " + i + ": " + JSON.stringify(errorsArr[i]));
        }
    },

    handleClearError: function(component, event) {
        /* do any custom error handling
         * logic desired here */
    }
})

When I click submit button I get below error.

User-added image

Please correct me if I any mistake in my code. you help is much appreciated.
Here is my apex batch:

global class EmailAlertToQuoteProposalApprovalUser implements Database.Batchable<sObject>, database.stateful{
    
    public String EVENT_TYPE_MEETING = 'Meeting';
    private Datetime EndTime=System.now();
    private String query;
    public String limitSize;
    private long recordcount;
    private string debuglog='';
    private integer batchcounter=0;
    private datetime processstarttime=system.now();
    private boolean haserror=false;
    private set<id> processedaccounts=new set<id>();
   
    global EmailAlertToQuoteProposalApprovalUser(datetime activitydatetime){
        if(activitydatetime==null){
            EndTime=System.now().adddays(-1);
        }
    }
   
   global Database.QueryLocator start(Database.BatchableContext BC){
       log('Batch process start time: ' + processstarttime);
       log('Batch process id: ' + bc.getJobID());
       log('Acvitity End Time Parameter: ' + EndTime);
       Datetime dtTimeNow=system.now();
       query='SELECT Id,Pending_With_Email__c,Submitted_Date_time__c FROM Apttus_Proposal__Proposal__c WHERE Submitted_Date_time__c!=null AND Submitted_Date_time__c>=: dtTimeNow' + ' ORDER BY Id';
       if(limitSize!=null)
       {
        query = query + ' LIMIT ' +  limitSize;
       }     
            
       log(query); 
       return Database.getQueryLocator(query);                                    
      
    }
   
    global void execute(Database.BatchableContext BC, List<sObject> scope){
        log('Batch number: ' + batchcounter);
        set<id> QuoteProposalId=new set<id>(); 
        list<Apttus_Proposal__Proposal__c>  lstQuoteProposal=new list<Apttus_Proposal__Proposal__c>();
        for(sobject so: scope){
            id quoteid=(Id)so.get('Id');
            Apttus_Proposal__Proposal__c objQuote= (Apttus_Proposal__Proposal__c)so;
            if(!processedaccounts.contains(quoteid)){
                QuoteProposalId.add(quoteid);
                lstQuoteProposal.add(objQuote);
            }
        }
        if(QuoteProposalId.size()>0){
            log('Number of accounts to be processed: ' + QuoteProposalId.size());
            log('Account Ids: '+ QuoteProposalId);
            List<String> CCAddress=new List<String>();
            CCAddress.add('abaranwal@kloudrac.com');
            string TemplateId=system.Label.quoteEmailTemplate;
            
            processedaccounts.addAll(QuoteProposalId);
            try{
                Messaging.SingleEmailMessage[] mails=new Messaging.SingleEmailMessage[0];
                 
                for(Apttus_Proposal__Proposal__c qt:lstQuoteProposal){
                    list<string> AdditionalRecipients=new list<string>();
                    AdditionalRecipients.add(qt.Pending_With_Email__c);
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    mail.setToAddresses(AdditionalRecipients);
                    mail.setCcAddresses(CCAddress);
                    //mail.setOrgWideEmailAddressId(OrgWideEmailId);
                    mail.setTemplateId(TemplateId);
                    mail.whatid=qt.id;
                    mail.setTargetObjectId('003n0000008FULE'); 
                    mails.add(mail);

                }
                
                log('Sending emails ... count: ' + mails);
                Messaging.sendEmail(mails); 
            
                        
            }catch(Exception e) {
                haserror=true;
                string body=e.getMessage();
                log(body);
    
            }
        }else{
            log('No Quote/Proposal is processed in this batch');
        }
        ++batchcounter;
    }

    global void finish(Database.BatchableContext BC){
        log('Entire batch process has ended');
        SaveDebugLog();
    } 
    
    public static void SendEmail(String Subject,String Body,String[] Recipeints){
        /*String Displayname=Lookup.getTarget('UpdateOpportunity', 'Config','FromAddress', true);
        //OneCRM.sandbox@ge.com
        Id OrgWideEmailId=[Select Id, DisplayName, Address from OrgWideEmailAddress where Address =:Displayname].Id;    
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(Recipeints);
        mail.setSubject(Subject);
        mail.setPlainTextBody(Body);
        mail.setOrgWideEmailAddressId(OrgWideEmailId);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});*/
                
    }
    

    private void log(string msg){
        debuglog+=msg+'\n';
        system.debug(logginglevel.info,msg);
    }
    
    private Id SaveDebugLog(){
        String recStr =  'Transaction Log';
        
        Integration_Log__c log= new Integration_Log__c();
        log.Call_Method__c = 'BatchProcessQuoteProposalEscalationEmail';
        log.Object_Name__c = 'Quote/Proposal';
        log.Call_Time__c = processstarttime;            
        log.Status__c = haserror?'Failure':'Success';
        insert log;        
        
        recStr += '\nInterfaceId:' + log.Object_Name__c;
        recStr += '\nObjectId:' + log.Object_Id__c;
        recStr += '\nCallTime:' + log.Call_Time__c.format('yyyy.MM.dd  HH:mm:ss.SSS z');
        recStr += '\nStatus:' + log.Status__c;
        recStr += '\nLogId:'+ log.Id;
        recStr += '\n';            
        recStr += debuglog;
        
        Blob recBlob= Blob.valueOf(recStr);
        Attachment att= new attachment();
        att.Name = 'Log Details ' +system.now()+'.txt';
        att.ParentId = log.Id; 
        att.Body = Blob.valueof(recStr); 
        insert att;     
        
        return log.id;
    }    
    
    public static void startbatch(datetime activitytime){
        
        EmailAlertToQuoteProposalApprovalUser aula=new EmailAlertToQuoteProposalApprovalUser(activitytime);
        aula.log('activitytime: ' + activitytime);
        aula.EndTime=activitytime;
        if(activitytime==null){
            aula.EndTime=System.now().adddays(-1);
        }
        ID batchprocessid = Database.executeBatch(aula);
        System.debug('Apex Job id: ' + batchprocessid );
    }
}


And here is schedulable:  I want to run batch file after every 5 minutes... Please Help
===============================================

global class scheduledQuoteReminderBatchable implements Schedulable {
   global void execute(SchedulableContext sc) {
       EmailAlertToQuoteProposalApprovalUser aula=new EmailAlertToQuoteProposalApprovalUser(system.now());
       ID batchprocessid = Database.executeBatch(aula);
       
   }
}
I have a formula field that averages survey responses and excludes null values. How can I prevent from dividing by 0 if all the responses are null? (If the second part of this formula = 0)

(IF(ISBLANK(CS1_Q1_answer__c),0,CS1_Q1_answer__c)+
IF(ISBLANK(CS1_Q2_answer__c),0,CS1_Q2_answer__c)+
IF(ISBLANK(CS1_Q3_answer__c),0,CS1_Q3_answer__c)+
IF(ISBLANK(CS1_Q4_answer__c),0,CS1_Q4_answer__c))

/

(IF(ISBLANK(CS1_Q1_answer__c),0,1)+
IF(ISBLANK(CS1_Q2_answer__c),0,1)+
IF(ISBLANK(CS1_Q3_answer__c),0,1)+
IF(ISBLANK(CS1_Q4_answer__c),0,1))
Email alert workflow is not working for group email when we give the recipient type as Email Field.Hello,

I have created a workflow for email alert and given reciepeient as Email Field. I have custome Email type field in the object. When ever I have entered group email id as NAM_USA_dl-IntegrationTeam@neo.com in the custom filed but workflow is not working for the group email.

Note : When I enter my email id or individual email id its working as expected.

Can any of you please suggest me how can we fix this issue?

Thanks,

Srinivas G
I have one object opportunity that is the  parent of object "BigMachines__Opportunity__c". Whenever a user insert more than one quote for a single pportunity, error should be thrown. I cant use roll up summary field.
Can anyone please tell me how to write a trigger for this.

Thanks,
Disha
  • October 29, 2015
  • Like
  • 0
I need to create a field that is a formula field that auto-populates the date as two weeks from the Close Date of an opportunity but can be overwritten...can anybody help?
Hi I need help with apex .  I have created lookup field to user on contact object.  This is so i can bypass that fact that contacts are created by api user and have ownerid as api user.  in the absence of queues for contacts i have created the following trigger to populate allocated_user__c with a random user name thats is in anyone of 4 roleids:

List< User > uList = [select id from User where isActive = true && userroleid = ‘00E25000000QO8O’, ‘00E25000000QO8T’, 

‘00E25000000QO8d’, '00E25000000QO8i'];
 

if ( uList.size() > 0 )
{
  for ( contact con : Trigger.new )
  {
     if ( contact.allocated_owner__c == null ) contact.allocated_owner__c = uList.get( Math.floor( Math.random() * 

uList.size() ).intValue() );
  }
}

i get issues when adding to sandbox - 

could you be kind enough to correct this code?
After setting up the web 2 lead function of SalesForce, am I able to have a workflow email or some other notification be generated to a user when a new lead comes in?  
I wan to write trigger in such a way that when ever a new lead is created, with the same name i want to create another lead... In short.. I want to create the clone of lead... when new lead is getting created... plz help..
Hi Guys,

Tell Me, What are the Security and Sharing concepts. I want list of security and sharing concepts.


Thanks in advance
Thulasi
This is how we caluclate call points: IF(
(
Case( Seniority__c ,"VP",3,"Director",2,0)+
Case(  Infer_Rating2__c ,"A",1,"B",0.5,"D",-1,0)+
Case(Account.infer_smart_signal_company_size__c,"501-1000",0.5,"201-500",0,"51-200",-0.5,"",0,"1-10",-1,"11-50",-1,1)
)
>= 0,
Case( Seniority__c ,"VP",3,"Director",2,0)+
Case( Infer_Rating2__c,"A",1,"B",0.5,"D",-1,0)+
Case(Account.infer_smart_signal_company_size__c,"501-1000",0.5,"201-500",0,"51-200",-0.5,"",0,"1-10",-1,"11-50",-1,1),
0)

What I want to do is; if (Account.infer_smart_signal_company_size__c) is "" or null, then look here (#_of_employees, "50-100", 0.5). how do I do this? how would I add it on to the current statement?

​Many thanks! 
Hi

In Opportunity, I wish to create a custom field like 'StageName' having a similiar function and layout as in the screenshot:

User-added image

1. How can create such field? 
2. If this is not possible I've a question why such different layout/function for this field alone (StageName) ?
  • October 22, 2015
  • Like
  • 0
Is it possible to migrate a custom multi-select picklist using Salesforce Migration Tool?   If yes, how do you place it in the Package.xml?   Is there any other special consideration / care to be taken?
I have a process builder that is creating detail records and populating a few fields on creation. I also have an after insert trigger that is firing based on one of the fields that is populated during the record creation in the process builder.  Both function perfectly independently but when a record is created through the process builder that should fire the trigger it does not.  Any ideas or resources would be greatly appreciated since I'm new to triggers?
Hi,

I have requirement to parse only Month and year from exisiting Date field. I have got formula for month (below) but how to add Year in the formula? Please help

CASE(
MONTH(FirstRespondedDate ),
  1, "January",
  2, "February",
  3, "March",
  4, "Apr",
  5, "May",
  6, "June",
  7, "July",
  8, "August",
  9, "September",
  10, "October",
  11, "November",
  12,"December",
"")
Trailhead seems to not be working well today.  It isn't recording my completed challenges and now is saying that I need to log in, but then won't let me do so.  Any idea?
This is how we caluclate call points: IF(
(
Case( Seniority__c ,"VP",3,"Director",2,0)+
Case(  Infer_Rating2__c ,"A",1,"B",0.5,"D",-1,0)+
Case(Account.infer_smart_signal_company_size__c,"501-1000",0.5,"201-500",0,"51-200",-0.5,"",0,"1-10",-1,"11-50",-1,1)
)
>= 0,
Case( Seniority__c ,"VP",3,"Director",2,0)+
Case( Infer_Rating2__c,"A",1,"B",0.5,"D",-1,0)+
Case(Account.infer_smart_signal_company_size__c,"501-1000",0.5,"201-500",0,"51-200",-0.5,"",0,"1-10",-1,"11-50",-1,1),
0)

What I want to do is; if (Account.infer_smart_signal_company_size__c) is "" or null, then look here (#_of_employees, "50-100", 0.5). how do I do this? how would I add it on to the current statement?

​Many thanks! 

I'm very new to this so any  help would be of great assistance!

I'm currently using the below trigger;
I'm trying to get the trigger to update the AccountOwnerID ONLY within "Contacts"  when the "Accounts" ownerID is changed.

Currently "Oppurtunities" is being changed as well, which defeats the purpose for us.

I'm not sure this is even possible, so any help would be greatly appreciated.
 

trigger Changeownertrigger on Account (after insert,after update) {
       
          Set<Id> accountIds = new Set<Id>();
          Map<Id, String> oldOwnerIds = new Map<Id, String>();
          Map<Id, String> newOwnerIds = new Map<Id, String>();
          Contact[] contactUpdates = new Contact[0];
          
          for (Account a : Trigger.new)
          {
             if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId)
             {
                oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId);
                newOwnerIds.put(a.Id, a.OwnerId);
                accountIds.add(a.Id);
             }

          }
            if (!accountIds.isEmpty()) {
             for (Account acc : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) FROM Account WHERE Id in :accountIds])
                {
                String newOwnerId = newOwnerIds.get(act.Id);
                String oldOwnerId = oldOwnerIds.get(act.Id);
                for (Contact c : acc.Contacts)
                {
                   if (c.OwnerId == oldOwnerId)
                   {
                   Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId);
                   contactUpdates.add(updatedContact);
                   }
                }
                 
                }
           }
                update contactUpdates;
    }

Hi All,
     I had gone through some problems working withDescription field so now I got a solution to work with "Long Text Area DataType", if you want to count() the records or other filtering things with Description.
   I made a custom field "Notes__c"(Text Area) in contact object and using Trigger i copied the contents of Description field to Notes__c.
here is the code:
trigger CopydescToNotes on Contact (before insert,before update) {
for(Contact c : Trigger.new)
if(c.Description!=null)
c.Notes__c=c.Description;
}


Thanks 
Shephali
public with sharing class Month {

    private List<Week> weeks;
    private Date upperLeft;

    public Date firstDate;

    public List<Date> getValidDateRange() {
        List<Date> ret = new List<Date>();
        ret.add(upperLeft);
        ret.add(upperLeft.addDays(5*7));
        return ret;
    }

    public String getMonthName() {
        return DateTime.newInstance(
            firstDate.yaer(), 
            firstDate.month, 
            firstDate.day())
                .format('MMMM');
    }

    public String getYearName() {
        return DateTime.newInstance(
            firstDate.yaer(), 
            firstDate.month, 
            firstDate.day())
                .format('yyyy');
    }

    public String[] getWeekdayNames() {
        Date today = system.today.toStartOfWeek();
        DateTime dt = DateTime.newInstanceGmt(
            today.year(),
            today.month(),
            today.day());
            List<String> ret = new List<String>();
            for (Integer i = 0; i < 7; i++) {
                ret.add(dt.formatgmt('EEEE'));
                dt = dt.addDays(1);
            }
            return ret;
    }

    public Date getfirstDate() {
        return firstDate;
    }

    public Month(Date value) {
        weeks = new List<Week>();
        firstDate = value.toStartOfMonth();
        upperLeft = firstDate.toStartOfWeek();
        Date tmp = upperLeft;
        for(Integer i = 0; i< 5; i++) {
            Week w = new Week(i+1, tmp, value.month());
            system.assert(w != null);
            this.weeks.add(w);
            tmp = tmp.addDays(7);
        }
    }

    public void setEvents(List<Event> ev) {
        for (Event e:ev) {
            for (Week w:weeks) {
                for (Day c:w.getDays()) {
                    if (e.Activity.isSameDay(c.theDate)) {
                        c.eventsToday.add(new Event(e));
                    }
                }
            }
        }
    }

    public List<Week> getWeeks() {
        system.assert(weeks != null, 'could not create weeks list');
        return this.weeks;
    }

}

Anyone understand thie error ??

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.