• sagar077
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 23
    Replies
Hi Everyone,
Please help me with this Requirement.

On Opportunity object, I have picklist field and on opportunity object and i have one custom button with the name "New Quote" (its use to create new Quote) so I want to throw an error message if the type is "none" or "black " and on the click of New Quote" before creating the quote.
Picklist field valuenew quote custom button
Hi Everyone,
Please help me with this Requirement.
On Opportunity object, I have picklist field and on opportunity object and i have one custom button with the name "New Quote" (its use to create new Quote) so I want to throw an error message if the type is "none" or "black " and on the click of New Quote" before creating the quote.Picklist valuenew quote custom button
Requirement-

If the start date on the quote object is today and the subscription term is 12 on the quote object, then the end date (on the quote object) should be auto-updated to 3/19/2022. I have created a workflow rule for that but it's not working.

Please help me with this requirement.
User-added image
User-added image
Hi Everyone help me with this error,

 I am using this formula on the quote object but getting an error -- Formula(s) that reference this field are no longer valid: Compiled formula is too big to execute (6,019 characters). Maximum size is 5,000 characters (Related field: Formula) 

AND(OR(ISPICKVAL(SBQQ__Type__c ,"Amendment"), ISPICKVAL(SBQQ__Type__c ,"Renewal")),
IF(Quantity_Of_Ischemic_Stroke_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Ischemic_Stroke_Family__c,true,

IF(Quantity_Of_Cerebral_Aneurysm_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Cerebral_Aneurysm_Family__c,true,

IF(Quantity_Of_Hemorrhagic_Stroke_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Hemorrhagic_Stroke_Family__c,true,

IF( Quantity_Of_Support_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Support_Family__c,true,

IF( Quantity_Of_Synchronized_Care_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Synchronized_Care_Family__c,true,false))))))
 
Hi Everyone, I am using this formula on the quote object but getting an error -- Formula(s) that reference this field are no longer valid: Compiled formula is too big to execute (6,019 characters). Maximum size is 5,000 characters (Related field: Formula) 

AND(OR(ISPICKVAL(SBQQ__Type__c ,"Amendment"), ISPICKVAL(SBQQ__Type__c ,"Renewal")),
IF(Quantity_Of_Ischemic_Stroke_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Ischemic_Stroke_Family__c,true,

IF(Quantity_Of_Cerebral_Aneurysm_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Cerebral_Aneurysm_Family__c,true,

IF(Quantity_Of_Hemorrhagic_Stroke_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Hemorrhagic_Stroke_Family__c,true,

IF( Quantity_Of_Support_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Support_Family__c,true,

IF( Quantity_Of_Synchronized_Care_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Synchronized_Care_Family__c,true,false))))))
Hi Everyone,

How to increase the list price without changing the quantity for amendment quotes? (In cpq )

Help me thanks in advance
Hi Everyone,

I need to Pullout the Standard Price Book value from the Product Object to Quote Line object (and want to store it in the custom field) by using customization in CPQ..

Thanks
Hi Everyone,

I need to Pullout the Standard Price Book value from the Product Object to Quote Line object (and want to store it in the custom field) by using customization in CPQ.

Thanks in Advance
Hi Everyone,

I am getting this error while saving quote in the production org. plz, help me with it. What changes i have to do?

Thanks In advance​​​​​​User-added image
Hi Everyone,

I am getting this error while saving quote in the production org. plz help me with what changes. I have to do?

Thanks In advance​​​​​​User-added image
Hi Everyone,
Creating a Contract for an Amendment Opportunity is it Best practices or Not? If Yes then Why and If No then Why?  Or any other way to execute it. (Cpq question ) plz, help with this one.
 
Thanks in Advance
Hi Everyone,
Creating a contract for an amendment opportunity is correct or not ? Or any other way to execute it. (Cpq question ) plz, help with this one.
Thanks in Advance
Hi Everyone, I need help to write a trigger for update the Source_Opportunity__c lookup field on (Opportunity Object)  with the original Opportunity name. The requirement is if the amendment contract is created then we have to update the SourceUser-added image
Hi everyone,
I want to update the opportunity field name (lookup field on the opportunity ) if the amendment contract is created in CPQ salesforce. Want to perform only by the automation process.
Need to set up a product with the price-setting per user per month if a quote term is for 27 months, the product should calculate its list price(250$) * 27 months in salesforce CPQ (need to solve by configuration only )
Need to set up a product with the price-setting per user per month if a quote term is for 27 months, the product should calculate its list price * 27 months in salesforce CPQ (need to solve by configuration only )
Need to set up a product with the price-setting per user per month if a quote term is for 27 months, the product should calculate its list price * 27 months in salesforce CPQ (need to solve by configuration olny)
Hi

Create an Apex trigger that will count the number of contacts associated with an account(create a field at account level). Must update the count in insertion and deletion of contact by using Map.

I am done with using map but i am unable to complete one case ie- if account having associated with 2 contacts and I changed the Account Name 'A' to Account 'B' then the count of contact fields not update the count of contact.

Pleases help me in code
Thanks 

trigger AccountCountContactMap on Contact (after insert,after update, after delete)
{
        Map <Id, List<Contact>> mapAcctIdContactList = new Map <Id, List<Contact>>();
        Map <Id, List<Contact>> mapAcctIdDelContactList = new Map <Id, List<Contact>>();
    
        Set<Id> AcctIds = new Set<Id>();
        List<Account> listAcc = new List<Account>();
      
    if(trigger.isinsert)
        {
            for(Contact Con : trigger.new)
                {
                    if(string.isNotBlank(Con.AccountId))
                    {
                        if(!mapAcctIdContactList.containsKey(Con.AccountId))
                        {
                            mapAcctIdContactList.put(Con.AccountId, new List<Contact>());        
                        }
                            mapAcctIdContactList.get(Con.AccountId).add(Con);
                            AcctIds.add(Con.AccountId);
                    }
                }
        }
    
    if(trigger.isupdate)
    {
        for(Contact Con:trigger.new)
            {
                 if(string.isNotBlank(Con.AccountId) && Con.AccountId !=trigger.oldmap.get(Con.Id).AccountId)
                    {
                        if(!mapAcctIdContactList.containsKey(Con.AccountId))
                        {
                            mapAcctIdContactList.put(Con.AccountId, new list <Contact>());
                        }
                            mapAcctIdContactList.get(Con.AccountId).add(Con);
                            AcctIds.add(Con.AccountId);
                   }
                    else if(string.isBlank(Con.AccountId) && string.isNotBlank(trigger.oldmap.get(Con.Id).AccountId))
                        {
                            if(!mapAcctIdDelContactList.containsKey(Con.AccountId))
                            {
                                 mapAcctIdDelContactList.put(Con.AccountId,new list<Contact>());   
                            }
                          mapAcctIdDelContactList.get(Con.AccountId).add(Con);
                          AcctIds.add(trigger.oldMap.get(Con.Id).AccountId);
                        }
            }
    }
 
     if(trigger.isdelete)
         {
            for(Contact Con : trigger.Old)
                {
                    if(string.isNotBlank(Con.AccountId))
                        {
                            if(!mapAcctIdDelContactList.containsKey(Con.AccountId))
                                {
                                    mapAcctIdDelContactList.put(Con.AccountId, new List<Contact>());
                                }
                            mapAcctIdDelContactList.get(Con.AccountId).add(Con);
                            AcctIds.add(Con.AccountId);
                        }
                }
         }
    
    if(AcctIds.size() > 0)
        {
            listAcc =[Select Id,Number_Of_Contact_Count__c from Account where Id in : AcctIds];
            for(Account acct : listAcc)
                {
                    Integer noofConts=0;
                    if(mapAcctIdContactList.containsKey(acct.Id))
                        {
                            noofConts += mapAcctIdContactList.get(acct.Id).size();
                        }
                    if(mapAcctIdDelContactList.containsKey(acct.Id))
                        {
                            noofConts -= mapAcctIdDelContactList.get(acct.Id).size();    
                        }
                    acct.Number_Of_Contact_Count__c = acct.Number_Of_Contact_Count__c == null ? noOfConts : (acct.Number_Of_Contact_Count__c + noOfConts);
                }
            update listAcc;
        }
}

plz help me
Create an Apex trigger that will count the number of contacts associated with an account(create a field at account level). Must update the count in insertion and deletion of contact by using MAP Collection.
Create an Apex Trigger that will count the number of contacts associated with an account(create a field at account level). Must update the count in insertion and deletion of a contact.

CODE-

trigger CountonAccountofcontact on Contact (after insert,after delete)
{
    Set<Id> mysetid = new Set <Id>();
        if(Trigger.isinsert)
        {
            System.debug('Insert new contact for trigger.new '+ Trigger.new);
            for(Contact contac :trigger.new)
                {
                    mysetid.add(contac.Accountid);
                }
            List<Account> Acc = [Select Id,Number_Of_Contact_Count__c from Account where Id in : mysetid];
            List<Contact> Con = [Select Id from Contact where Accountid in : mysetid];
            for(Account A: Acc)
                {
                    A.Number_Of_Contact_Count__c = Con.size(); 
                }
            update Acc;
            System.debug('Number of count is ' + Acc);
        }

     if(Trigger.isdelete)
        {
            System.debug('The Delete Contact Name For Trigger.old'+ Trigger.Old); 
            for(Contact contac : Trigger.Old)
                {
                    mysetid.add(contac.Accountid);
                }          
            List<Account> Acc = [Select id,Number_Of_Contact_Count__c from Account where id in: mysetid];
            List<Contact> Con = [Select id from Contact where Accountid in : mysetid];
           
            for(Account A :Acc)
                {
                    A.Number_Of_Contact_Count__c = Con.size();
                }
                update Acc;
            System.debug('The Update number is '+ Acc);
        }
    }

NOTE- This code is running but I want for After Update event also and Plz Help me in that 
Hi Everyone,
Please help me with this Requirement.
On Opportunity object, I have picklist field and on opportunity object and i have one custom button with the name "New Quote" (its use to create new Quote) so I want to throw an error message if the type is "none" or "black " and on the click of New Quote" before creating the quote.Picklist valuenew quote custom button
Requirement-

If the start date on the quote object is today and the subscription term is 12 on the quote object, then the end date (on the quote object) should be auto-updated to 3/19/2022. I have created a workflow rule for that but it's not working.

Please help me with this requirement.
User-added image
User-added image
Hi Everyone help me with this error,

 I am using this formula on the quote object but getting an error -- Formula(s) that reference this field are no longer valid: Compiled formula is too big to execute (6,019 characters). Maximum size is 5,000 characters (Related field: Formula) 

AND(OR(ISPICKVAL(SBQQ__Type__c ,"Amendment"), ISPICKVAL(SBQQ__Type__c ,"Renewal")),
IF(Quantity_Of_Ischemic_Stroke_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Ischemic_Stroke_Family__c,true,

IF(Quantity_Of_Cerebral_Aneurysm_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Cerebral_Aneurysm_Family__c,true,

IF(Quantity_Of_Hemorrhagic_Stroke_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Hemorrhagic_Stroke_Family__c,true,

IF( Quantity_Of_Support_Family__c >  SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Support_Family__c,true,

IF( Quantity_Of_Synchronized_Care_Family__c > SBQQ__Opportunity2__r.Source_Opportunity__r.SBQQ__PrimaryQuote__r.Quantity_Of_Synchronized_Care_Family__c,true,false))))))
 
Hi Everyone,

I am getting this error while saving quote in the production org. plz, help me with it. What changes i have to do?

Thanks In advance​​​​​​User-added image
Hi Everyone,

I am getting this error while saving quote in the production org. plz help me with what changes. I have to do?

Thanks In advance​​​​​​User-added image
Hi Everyone, I need help to write a trigger for update the Source_Opportunity__c lookup field on (Opportunity Object)  with the original Opportunity name. The requirement is if the amendment contract is created then we have to update the SourceUser-added image
Hi everyone,
I want to update the opportunity field name (lookup field on the opportunity ) if the amendment contract is created in CPQ salesforce. Want to perform only by the automation process.
Need to set up a product with the price-setting per user per month if a quote term is for 27 months, the product should calculate its list price * 27 months in salesforce CPQ (need to solve by configuration olny)
Create an Apex trigger that will count the number of contacts associated with an account(create a field at account level). Must update the count in insertion and deletion of contact by using MAP Collection.
After copying from Trailhead ; I'm recieving an error for line 9. expecting right curly bracket , found "insert". Please advise.

// Create a list of contacts
02List<Contact> conList = new List<Contact> {
03    new Contact(FirstName='Joe',LastName='Smith',Department='Finance'),
04        new Contact(FirstName='Kathy',LastName='Smith',Department='Technology'),
05        new Contact(FirstName='Caroline',LastName='Roth',Department='Finance'),
06        new Contact(FirstName='Kim',LastName='Shain',Department='Education')};
07             
08// Bulk insert all contacts with one DML call
09insert conList;
10 
11// List to hold the new contacts to update
12List<Contact> listToUpdate = new List<Contact>();
13 
14// Iterate through the list and add a title only
15//   if the department is Finance
16for(Contact con : conList) {
17    if (con.Department == 'Finance') {
18        con.Title = 'Financial analyst';
19        // Add updated contact sObject to the list.
20        listToUpdate.add(con);
21    }
22}
23 
24// Bulk update all contacts with one DML call
25update listToUpdate;
trigger should work for after insert , after update, after delete, after undelete 
 Thanks  in advance
Hi! 
I've created a trigger under contacts to populate a custom field on the Account object that says how many contacts are under that one account. It's been uploaded through sandbox, but it doesn't seem to be working. Here's the code I'm using: 

Trigger NumberContacts on Contact(after update,after insert){
    Set<ID> accids=New Set<ID>();
    For(contact c:trigger.new){
        Accids.add(c.AccountId);
    }

    Map<ID,Account> Acc= new Map<ID,Account>([Select ID, No_of_Contacts_SFDC__c from account where id IN:accids ]);
    Map<ID,Account> updateMap = new Map<ID,Account>();
    for(Account ac :Acc.values())
    {
        Integer count = 0;
        for(Contact c:Trigger.New){
            if(ac.Id == c.AccountId)
                count = count + 1;
            
        }
        ac.No_of_Contacts_SFDC__c= count;
        updateMap.put(ac.Id,ac);
    }

    if(!updateMap.isEmpty())
        update updateMap.values();
}

Is there something wrong with the code? The field updates to 1 the first time I add a contact, and then nothing updates after that. Not sure what's going on. Thanks! 
Hi All,

Does anyone have any idea to how to count the number of occurrences of all the elements present in a list ? For Example, I have a list of names.
List is having 10 elements with values {A,B,C,D,A,B,A,A,A,A}. Now here A came 6 times, B came 2 times , C came 1 time and D also 1 time. But I don't know how to do it in apex.
Please help how can I get the count of repeated values in apex.
Hi,

I'm new to developing in general and I am trying to create a trigger that updates the custom lookup field Bid_Name__c on the standard Opportunity object. I have a created a custom object called Bid__c which has a related one-to-one relationship with the Opportunity. I'm getting an error when attempting to save the Opportunity record, although it mentions the correct reference below but doesnt populate the field. My code is pasted below the error message.

System.StringException: Invalid id: Bid-1312: Trigger.UpdateBid: line 9, column 1

trigger UpdateBid on Opportunity (before insert, before update) {
    if (trigger.isBefore) { 
        if (trigger.isInsert || trigger.isUpdate) {
            //list Bids
            list<Bid__c> Bid = [SELECT ID, Name FROM Bid__c];
            for (Opportunity o : trigger.new) {
                o.Bid_Name__c = null;
                for (Bid__c b : Bid){
                    if (b.Name == o.Bid_Name__c) {
                        o.Bid_Name__c = b.Name;
                        break;
                    }
                }
            }
        }
    }
}

Any help that could be offered would be appreciated, struggling to work out what the solution here is.

Thank you
trigger CountFemales1 on Contact (after insert,after update,after delete)
{
set<id>  conId = new set<id>();

 if(trigger.isInsert||trigger.isUpdate)
 {
  for(contact c: trigger.new)
  {
   if(c.accountid!=null)
   {
   conId.add(c.accountid);
   }
  }
 }
 
 
 if(trigger.isDelete)
 {
 for(contact c:trigger.old)
 {
  if(c.accountid!=null)
  {
  conId.add(c.accountid);
  }
 }
 
 
list<account> FemaleList = [select id  ,(select Accountid, Sex__c from contacts where Sex__c='Female') from account where id In :conId];
 map<id,integer> countMap = new map<id,integer>();
 for(account a :FemaleList)
 {
 countMap.put(a.id, a.contacts.size());
 }
 
 
 list<account> countlist = [select Count_of_Females__c from account where id in :conId];
 for(account a : countlist)
 {
 //Integer countoffemale = countMap.get(a.id);
 //a.Count_of_Females__c= countoffemale;
  a.Count_of_Females__c= countMap.get(a.id);
 }
 update countList;

}  
    
}


I want that it should display the count of no. of contacts where sex = female 
it m able to  save the trigger but  there is no result  displayed ( its not displaying the count of females in account , even though i have contacts where sex= female in the picklist)

any help?
Hi All,

I want to display number of contacts associated with an account using triggers.

for this I had created a lookup field like noofcontacts__c in account  object. and Wrote code as

trigger numberofcontacts on contact(after insert, after update, after delete) {
    Map<Id, List<Contact>> AcctContactList = new Map<Id, List<Contact>>();
    Set<Id> AcctIds = new Set<Id>();   
    List<schema.Account> AcctList = new List<schema.Account>();
    List<schema.Contact> ConList = new List<schema.Contact>();
   
    if(trigger.isInsert || trigger.isUPdate) {
        for(Contact Con : trigger.New) {
            if(String.isNotBlank(Con.AccountId)){
                AcctIds.add(Con.AccountId); 
            }  
        } 
    }
   
    if(trigger.isDelete) {
        for(Contact Con : trigger.Old) {
            AcctIds.add(Con.AccountId);    
        } 
    }          
   
    if(AcctIds.size() > 0){
        ConList = [SELECT Id, AccountId FROM Contact WHERE AccountId IN : AcctIds];
       
        for(Contact Con : ConList) {
            if(!AcctContactList.containsKey(Con.AccountId)){
                AcctContactList.put(Con.AccountId, new List<Contact>());
            }
            AcctContactList.get(Con.AccountId).add(Con);     
        }                          
      
           
        AcctList = [SELECT noofContacts__c FROM Account WHERE Id IN : AcctIds];
        for(Account Acc : AcctList) {
            List<schema.Contact> ContList = new List<schema.Contact>();
            ContList = AcctContactList.get(Acc.Id);
            Acc.Number_of_Contacts__c = ContList.size();
        }   
       
      
        update AcctList;   
    }

}
 I am   getting an error as "Variable doesnot exist:id".

Kindly support and suggest.

Thanks

To take the example from the docs:

AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity 
GROUP BY CampaignId];

Now try

Map<ID, AggregateResult> resultsMap = [SELECT CampaignId, AVG(Amount) 
 FROM Opportunity 
 GROUP BY CampaignId]; 

This won't work even though CampaignId is of type ID. To make it work, alias CampaignId with Id:

Map<ID, AggregateResult> resultsMap = [SELECT CampaignId Id, AVG(Amount) 
 FROM Opportunity 
 GROUP BY CampaignId]; 

Interestingly, the case here does matter. Aliasing with id or ID won't work.

 

This worked on March 28th 2012 (seriously, I swear it did! :-), but does not any more.

 

Please support my idea at https://sites.secure.force.com/success/ideaView?id=08730000000hmhOAAQ to reinstate this behavior.