• Kalpesh_007
  • NEWBIE
  • 0 Points
  • Member since 2011
  • Salesforce Spidy
  • Creation Technology Services


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Is it possible to reduce the if else statements in the below code, I am interested to know :-
if (engagementStatusSet.contains(CommonConstants.CONS_CONT_NEW) && engagementStatusSet.size() == 1) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONS_CONT_NEW));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONTACT_ESTATUS_UNRESPONSIVE) && engagementStatusSet.size() == 1) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONTACT_ESTATUS_UNRESPONSIVE));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONS_CONT_RECYCLED) && engagementStatusSet.size() == 1) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONS_CONT_RECYCLED));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONTACT_ESTATUS_DONOTCONTACT) && engagementStatusSet.size() == 1) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONTACT_ESTATUS_DONOTCONTACT));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONTACT_ESTATUS_BADDATA) && engagementStatusSet.size() == 1) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONTACT_ESTATUS_BADDATA));
				} 
				else if (engagementStatusSet.contains(CommonConstants.CONS_CONT_CUSTOMER)) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONS_CONT_CUSTOMER));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONS_CONT_PROSPECT)) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONS_CONT_PROSPECT));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONS_CONT_ENGG_STS)) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONS_CONT_ENGG_STS));
				}
				else if (engagementStatusSet.contains(CommonConstants.CONTACT_ESTATUS_APPROACHING)) {

					lstAccount.add(new Account (Id=accountId,Engagement_Status__c = CommonConstants.CONTACT_ESTATUS_APPROACHING));
				}

 
For Example:-In the description field of Product Object,we have the text as 'Opportunity.Name+ " Quantity : " +Quantity', On Opportunity Product, Now if we create a formula field on Opportunity Product and refer the product description field in that formula and the formula in Product description field should get parse on Opportunity Product. We should also be able to use the same use case in workflow field Update

Is it Possible to Convert a Visualforce Page as a Image.

hi,

 

An salesforce custom object doesn’t support JavaScript, I am not able to run JavaScript for the object, I have even tried some simple code like alert(), but it doesn’t work, Does anybody knows how to solve this problem.

 

In IE the error:- "object doesn't support this property or method"

 

in Mozilla and safari error:-result of an expression "Util.stripCustomFunctionFromObjectPrototype" not a function[undefined]

 

javascript seems to work for all custom objects except this object.

any help will be appreciated .

 

regards,

kaalp

Here is the relationship of an custom object (all are Lookup relations)
A--> B --> C
A--> D
Trying To Achieve, if a new record is created in "D" then "C" Custom field need to capture "D" latest record Name in a custom field (latest_D_Name__c)

I have written below code, I tested with Bulk data as well its working fine
But i want this to optimize as much as possible and make it simple. any suggestion will be helpful

Question in my mind always popping up, Why am getting Null when am trying to pull A.ID (C.B__r.A__c) through "1st For Loop" directly.
If i find a way to pull the A.id from "1st For Loop" , then i can get rid of "2nd For Loop" */
 
trigger C_CustomObjTrigger on C_CustomObj  (Before Update) {  
     set<ID> B_idset = new set<ID>();
     set<ID> A_idset = new set<ID>();
     // Getting Parent ID of Object C (1st For Loop)
     for(C_CustomObj C : Trigger.new){
          if(C.B_CustomObj != null)
             B_idset.add(C.B_CustomObj);
     }  
     // Getting Grand Parent ID (2nd For Loop)
     for(B_CustomObj B: [SELECT NAME,id,A_CustomObj FROM B_CustomObj where id in:B_idset]){
          if(B.A_CustomObj != null)
             A_idset.add(B.A_CustomObj);
     }  
    // pulling Childs list for Grand Parent  
     List<D_CustomObj> D = [Select id,name,Date__c,Value__c From D_CustomObj where A_CustomObj in: A_idset
                                          Order By Date__c Desc];
    If(Trigger.IsBefore) {  
    for(C_CustomObj C_Update: trigger.new){                                           
        if(C_Update.Approved__c == False){
           //Update the Decision Object :Latest D to be caluculated                                  
            if(D.size()>0){
                C_Update.latest_D_Name__c = D[0].Name;
            }                   
        }
   }        
 }

 
  • November 24, 2014
  • Like
  • 0
Do we know of any getting started or how to use material on SAQL ? Its Dev guide everything except how to use it :)

hi,

 

An salesforce custom object doesn’t support JavaScript, I am not able to run JavaScript for the object, I have even tried some simple code like alert(), but it doesn’t work, Does anybody knows how to solve this problem.

 

In IE the error:- "object doesn't support this property or method"

 

in Mozilla and safari error:-result of an expression "Util.stripCustomFunctionFromObjectPrototype" not a function[undefined]

 

javascript seems to work for all custom objects except this object.

any help will be appreciated .

 

regards,

kaalp