• sfdclearn
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 53
    Replies

Hi ,

 

 

    Is there a way to pull a list  of customizations(custom fields, workflows, email alerts,etc ) created by me in salesforce

just like we have a feature called Report of reports.

 

Thanks!!!!

 

Hi ,

 

   We have an email alert that sends out email to set of internal users. This email alerts are sending emails to users.

however an user says that he doesn't receive any email form salesforce. i just pulled an email log from sf that shows the email log on particular date. i do see an internal message id coloumn in that log. How do we know what email content is sent ?

it just shows the date , time,message header ,etc.,

 Any advise.

 

Thanks!!!!

Hi,

 

   I am using the following trigger to Update the Account status to 'customer'  when 

AccountStatus__c == 'PROSPECT'  and Asset.Status!='Returned'.

 

trigger AccountUpdate on Account (before insert, before update)
{

if(trigger.isAfter && trigger.isUpdate)
{
List<Account> lstAccount=new List<Account>();
List<Asset> lstAsset = [SELECT Status FROM Asset WHERE AccountID IN :trigger.new];
for(Account A : lstAccount)
{
for(Asset Asobj : lstAsset)
{
if(A.AccountStatus__c == 'PROSPECT' && Asobj.Status!='Returned')
{
A.AccountStatus__c= 'Customer';
Update A;
}


}

}
}

}

The Account status changes to customer only when i edit and save the Asset record.

For ex., if the account status='Prospect' && Asset.status='Purchased' this is not updated when the account is created or saved.

It works only when the asset it edited.

 

Please advise!!!

Hi,

 

 

   I am using the following code to pull all the opportunity product names associated to a single account in a custom text field in account ProductNameCopy__c.

Now i am trying to change the logic something like if there is more than one product associated to the Account .

   If more than one product in associated to account then 

     just assign ProductNameCopy__c='Academic'.  (ranking down all the product names to single package name).

 

  

trigger MyAccountTrigger1 on Account(before update, before insert) {

Map<ID,Set<String>> aIdToUniqueProductSetMap = new Map<ID,Set<String>> ();
Set<String> uniqueProdSet= new Set<String>();

// Go through each Oppo and collect a unique set of Product names from all OLI
for (Opportunity o : [select id, accountId, 
                        (select id, PricebookEntry.Product2.Name from OpportunityLineItems) 
                      from Opportunity where accountId IN :Trigger.new] ) {
  Set<String> productsInOppoSet = new Set<String> (); 
  //reset our set for this Oppo
  for (OpportunityLineItem oli : o.opportunityLineItems) 
     productsInOppoSet.add(oli.PricebookEntry.Product2.Name);
  // With the unique set, add it into our Map associating each account to its unique product set
  if (aIdToUniqueProductSetMap.containsKey(o.accountId)) {
       uniqueProdSet = aIdToUniqueProductSetMap.get(o.accountId); // add this Oppo's unique set to whatever we have so far
      uniqueProdSet.addAll(productsInOppoSet);
      aIdToUniqueProductSetMap.put(o.accountId,uniqueProdSet); // put it back in the Map
  }    
  else
      aIdToUniqueProductSetMap.put(o.accountId,productsInOppoSet); // first Oppo for this Account; simply do a put

}

// All done with Oppos, now put back into each triggered Account

for (Account a: Trigger.new) 
{
  
  
    
  if (aIdToUniqueProductSetMap.containsKey(a.id))
   {  // only for those Accounts that had Oppos with products
     a.testfield__c=uniqueProdSet.size();
     String concatenatedProducts = ''; 
     for (String p : aIdToUniqueProductSetMap.get(a.id))   
         concatenatedProducts = concatenatedProducts + (concatenatedProducts.length() == 0 ? '' : '\n ') + p;// separate with spaces; other delims possible
           a.ProductNameCopy__c = concatenatedProducts ; // when the trigger completes, the triggered Accounts get updated
  }


}
}

 

Any advice on this!!!

 

Thanks!!!

 

I am using the following code to copy all the opportunity products of an Account in a custom text field in Account object.

Now i am trying to use a small logic. that is 

if there is more than one opportunity product associated to the account then don't copy all the names 

just assign a text 'Academic' to custom text field.

if there is only one product assigned then then copy the opportunity product nam.

 

 

trigger MyAccountTrigger1 on Account(before update, before insert) {

Map<ID,Set<String>> aIdToUniqueProductSetMap = new Map<ID,Set<String>> ();
Set<String> uniqueProdSet= new Set<String>();

// Go through each Oppo and collect a unique set of Product names from all OLI
for (Opportunity o : [select id, accountId,
(select id, PricebookEntry.Product2.Name from OpportunityLineItems)
from Opportunity where accountId IN :Trigger.new] ) {
Set<String> productsInOppoSet = new Set<String> ();
//reset our set for this Oppo
for (OpportunityLineItem oli : o.opportunityLineItems)
productsInOppoSet.add(oli.PricebookEntry.Product2.Name);
// With the unique set, add it into our Map associating each account to its unique product set
if (aIdToUniqueProductSetMap.containsKey(o.accountId)) {
uniqueProdSet = aIdToUniqueProductSetMap.get(o.accountId); // add this Oppo's unique set to whatever we have so far
uniqueProdSet.addAll(productsInOppoSet);
aIdToUniqueProductSetMap.put(o.accountId,uniqueProdSet); // put it back in the Map
}
else
aIdToUniqueProductSetMap.put(o.accountId,productsInOppoSet); // first Oppo for this Account; simply do a put

}
if(uniqueProdSet.size()>1)

{
for(Account a: Trigger.new)
{a.productNameCopy__c='Academic';}
}
else
{
// All done with Oppos, now put back into each triggered Account
for (Account a: Trigger.new)
{



if (aIdToUniqueProductSetMap.containsKey(a.id)) { // only for those Accounts that had Oppos with products
String concatenatedProducts = '';
for (String p : aIdToUniqueProductSetMap.get(a.id))
concatenatedProducts = concatenatedProducts + (concatenatedProducts.length() == 0 ? '' : ' ') + p; // separate with spaces; other delims possible
a.ProductNameCopy__c = concatenatedProducts ; // when the trigger completes, the triggered Accounts get updated
}
}

 

can anyone advise?

 

trigger productname on Account(after insert,after update)
{
   
    
        List<Account> lstAccounts = [Select ProductNameCopy__c from Account ];
        List<Opportunity> lstopptys = [SELECT Id, Name FROM Opportunity];
        
        List<Id> oppIds = new List<Id>();
        List<OpportunityLineItem> lstopptylineitem  = [SELECT Id, PricebookEntry.Product2.Name FROM OpportunityLineItem WHERE OpportunityId IN :oppIds];
        for(Opportunity o : lstopptys)
        {
           oppIds.add(o.Id);
         }
         
        
            for(Account objAccount : lstAccounts)
            {
               for(Opportunity objoppty : lstopptys)
               {
                for(opportunitylineitem objopplineitem : lstopptylineitem)
                {
                objAccount.ProductNameCopy__c=objopplineitem.PricebookEntry.Product2.Name;
                update objAccount;
                
                }
                
         }
         }
         }
I am using the above trigger to copy the opportunity product names in a custom field in the account object.

This trigger is saved without error. 

But doesn't copy the product name in the Account's custom field(ProductNameCopy).

 

Please advise!!!

Hi,

 

     We have a workflow rule in the Account object that triggers the email alert when the Account status is changed to 'Trial'.

Now we would like to include include theassociated opportunity product names of this account in the email template that goes out .

   So we should bring the product name(s) in the Account object in a custom field. which can be included as merge field.

  how to bring the product info in the account?

  

I have a custom text field in the Account. And i am trying to copy all the opportunity product names of the associated account in the custom text field.

Does anyone have sample trigger for this?

 

Thanks!

we have a workflow rule in the account object that triggers an email alert when 

Account status='new'

But i would like to add the product name in this to workflow rule.

As i can't directly include the product name from the account as each account has multiple opportunities and each opp has multiple products, i am thinking of creating a look up of product in the account(in this case i guess that can only be one product

mapped which can be populated with a mass update)

 

any best solutions for this!

 

Thanks!

we have a workflow rule in the account object that triggers an email alert when 

Account status='new'

But i would like to add the product name in this to workflow rule.

As i can't directly include the product name from the account as each account has multiple opportunities and each opp has multiple products, i am thinking of creating a look up of product in the account(in this case i guess that can only be one product

mapped which can be populated with a mass update)

 

any best solutions for this!

 

Thanks!

 

 

 

   I have a workflow rule in the Account object .

     if Accountstatus='new'

        then this rule triggers an email template to the customer.

 

    Now I would like to include the product name in the workflow. 

    which includes if(product name='xxx') then send the more specific template.(with the product name included on it).

 

    I believe this cannot be accomplished with a workflow rule as Account can have multiple opportunities and each opportunity is tied to several products.

    But is there a way to address this?

 

Thanks in advance for help!

Hi,

 

   I have a workflow rule in the Account object .

     if Accountstatus='new'

        then this rule triggers an email template to the customer.

 

    Now I would like to include the product name in the workflow. 

    which includes if(product name='xxx') then send the more specific template.(with the product name included on it).

 

    I believe this cannot be accomplished with a workflow rule as Account can have multiple opportunities and each opportunity is tied to several products.

    But is there a way to address this?

 

Thanks in advance for help!

  

 

Hi,

I am creating an email template. And I am trying to use if condition in email template.
{!if(Account.test__c="", "Field is empty", "please find the data below.
test : + Account.test__c+"contact xxx")}

This if condition works in the email template and prints the value if its test__c is not empty.
But i am not able to leave a line after please find the data below.is there a way to add a line return after this below.
Please advise.

Thanks!

Hi,

 

   I am creating an email template. And I am trying to use if condition in email template. 

{!if(Account.test__c="", "Field is empty", "please find the data below.

                                            test : + Account.test__c+"contact xxx")}

 

This if condition works in the email template and prints the value if its test__c is not empty.

But i am not able to leave a line after please find the data below.is there a way to add a line return after this below.

Please advise.

 

Thanks!

I am trying to generate year to date report to find the 

annual revenue for each of the accounts for
2011 and YTD 2012.How can i build this report

 

Thanks!

We have a Roll Up Summary field in the Account level that calculates SUM(Opportunity) with the following filter criteria.

1. Stage equals Closed/Won,Implementation.

I would like to add another filter criteria here which is

2. Product not equal to 'test'

In this scenario product is a related list to opportunity as its not a field i don't think i can add this filter criteria there.

But i am just wondering if there is anyother ways to do this like creating any formula field or something.

Please advise.

Thanks!

We have a Roll Up Summary field in the Account level that calculates SUM(Opportunity)  with the following filter criteria.

 

  1.       Stage equals  Closed/Won,Implementation.

 

  I would like to add another filter criteria here which is 

 

   2. Product not equal to 'test'

 

  In this scenario product is a related list to opportunity as its not a field i don't think i can add this filter criteria there.

 

But i am just wondering if there is anyother ways to do this like creating any formula field or something.

 

Please advise.

 

Thanks!

Hi ,

 

 

   I am writing a trigger that changes the picklist value based on a date field.

 

     I have a date field called renewal_date__c and if this date passes 60 days from this value then the picklist value should go to 'Declined Support'. Any suggestions on how this can be achieved?

 

Thanks!

Hi,

 

   I am new to creating Force.com Sites. Can anyone advise me the steps to build the force.com sites.

 

Thanks!

Hi

 

   I am trying to copy the value of a text field(Contact__C)in a custom object to a look up field(TPF_Primary_Contact__c) in a standard object with the following trigger.

 

trigger ContactUpdateonAccount on Customcontact__c(after insert,after update)
{
Map<Id, Customcontact__c> mapcustomcontactByAccountId = new Map<Id, Customcontact__c>();
for (Customcontact__c objcustomcontact: Trigger.new)
{
mapcustomcontactByAccountId.put(objcustomcontact.Account__c,objcustomcontact);
}

if( mapcustomcontactByAccountId.size() > 0)
{
List<Account> lstAccounts = [Select TPF_Primary_Contact__c from Account where ID IN : mapcustomcontactByAccountId.keySet()];
if(!lstAccounts.isEmpty())
{
for(Account objAccount : lstAccounts)
{
Customcontact__c objcustomcontact = mapcustomcontactByAccountId.get(objAccount.Id);
objAccount.TPF_Primary_Contact__c=objcustomcontact.Contact__C;

update objAccount;

}
}
}
}

 

When I use the trigger to update a text field in the standard object it works. But when i try to update look up field with the same trigger it doesn't allow me to save the record and throws the following error when the record in the custom object is saved.

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger ContactUpdateonAccount caused an unexpected exception, contact your administrator: ContactUpdateonAccount: execution of AfterInsert caused by: System.StringException: Invalid id: testc: Trigger.ContactUpdateonAccount: line 17, column 1

 

Please advise.

 

Thanks!

Hi ,

 

   We have an email alert that sends out email to set of internal users. This email alerts are sending emails to users.

however an user says that he doesn't receive any email form salesforce. i just pulled an email log from sf that shows the email log on particular date. i do see an internal message id coloumn in that log. How do we know what email content is sent ?

it just shows the date , time,message header ,etc.,

 Any advise.

 

Thanks!!!!

Hi,

 

   I am using the following trigger to Update the Account status to 'customer'  when 

AccountStatus__c == 'PROSPECT'  and Asset.Status!='Returned'.

 

trigger AccountUpdate on Account (before insert, before update)
{

if(trigger.isAfter && trigger.isUpdate)
{
List<Account> lstAccount=new List<Account>();
List<Asset> lstAsset = [SELECT Status FROM Asset WHERE AccountID IN :trigger.new];
for(Account A : lstAccount)
{
for(Asset Asobj : lstAsset)
{
if(A.AccountStatus__c == 'PROSPECT' && Asobj.Status!='Returned')
{
A.AccountStatus__c= 'Customer';
Update A;
}


}

}
}

}

The Account status changes to customer only when i edit and save the Asset record.

For ex., if the account status='Prospect' && Asset.status='Purchased' this is not updated when the account is created or saved.

It works only when the asset it edited.

 

Please advise!!!

trigger productname on Account(after insert,after update)
{
   
    
        List<Account> lstAccounts = [Select ProductNameCopy__c from Account ];
        List<Opportunity> lstopptys = [SELECT Id, Name FROM Opportunity];
        
        List<Id> oppIds = new List<Id>();
        List<OpportunityLineItem> lstopptylineitem  = [SELECT Id, PricebookEntry.Product2.Name FROM OpportunityLineItem WHERE OpportunityId IN :oppIds];
        for(Opportunity o : lstopptys)
        {
           oppIds.add(o.Id);
         }
         
        
            for(Account objAccount : lstAccounts)
            {
               for(Opportunity objoppty : lstopptys)
               {
                for(opportunitylineitem objopplineitem : lstopptylineitem)
                {
                objAccount.ProductNameCopy__c=objopplineitem.PricebookEntry.Product2.Name;
                update objAccount;
                
                }
                
         }
         }
         }
I am using the above trigger to copy the opportunity product names in a custom field in the account object.

This trigger is saved without error. 

But doesn't copy the product name in the Account's custom field(ProductNameCopy).

 

Please advise!!!

I have a custom text field in the Account. And i am trying to copy all the opportunity product names of the associated account in the custom text field.

Does anyone have sample trigger for this?

 

Thanks!

we have a workflow rule in the account object that triggers an email alert when 

Account status='new'

But i would like to add the product name in this to workflow rule.

As i can't directly include the product name from the account as each account has multiple opportunities and each opp has multiple products, i am thinking of creating a look up of product in the account(in this case i guess that can only be one product

mapped which can be populated with a mass update)

 

any best solutions for this!

 

Thanks!

we have a workflow rule in the account object that triggers an email alert when 

Account status='new'

But i would like to add the product name in this to workflow rule.

As i can't directly include the product name from the account as each account has multiple opportunities and each opp has multiple products, i am thinking of creating a look up of product in the account(in this case i guess that can only be one product

mapped which can be populated with a mass update)

 

any best solutions for this!

 

Thanks!

 

 

 

   I have a workflow rule in the Account object .

     if Accountstatus='new'

        then this rule triggers an email template to the customer.

 

    Now I would like to include the product name in the workflow. 

    which includes if(product name='xxx') then send the more specific template.(with the product name included on it).

 

    I believe this cannot be accomplished with a workflow rule as Account can have multiple opportunities and each opportunity is tied to several products.

    But is there a way to address this?

 

Thanks in advance for help!

Hi,

 

   I have a workflow rule in the Account object .

     if Accountstatus='new'

        then this rule triggers an email template to the customer.

 

    Now I would like to include the product name in the workflow. 

    which includes if(product name='xxx') then send the more specific template.(with the product name included on it).

 

    I believe this cannot be accomplished with a workflow rule as Account can have multiple opportunities and each opportunity is tied to several products.

    But is there a way to address this?

 

Thanks in advance for help!