• Jagadees
  • NEWBIE
  • 20 Points
  • Member since 2017
  • Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 4
    Replies
I am trying to create a validation rule that stops a second person being added to the Account Team if there is already someone else on the Account Team in that same role.
 
For example, there should never be more than 1 Pre-Sales Lead (Account Team role) on any 1 SFDC Account. 
 
Any "No Code" approach possible? Validation rules, as VR are now available onto AccountTeamMember object? Can someone help figure out a way for this?   
 
#AwesomeAdmins  #Ask An Expert  #DiscussSalesforceQueries
I have a business scenario where there should never be more than 1 XXXX EGM and 1 XXXX SAE (both these are Account Team roles) on any 1 SFDC Account. So I want to create a validation to prevent users from adding another duplicate XXXX role to an Account? The user should not be allowed to save the record if a duplicate XXXX roles already exists at the Account Team.

Business want to do it with "No Code" approach, if possible. Instead want to achieve this with the OOB functionalities. Can someone help figure out a way for this?

Hello friends,
I have two record types in my task object - one for my leads & another one for opportunity. Whenever users try to create a new task from a lead/opportunity related list, he/she is shown a choice to select any one of these record types and the respective page will opens up for the creation of the task. This is little cumbersome as they may end up choosing an irrelevant record type at times.
 
 As a solution, I am trying to create a custom list button with content source as URL passing the record type there -  as this will redirect to the concerned page layout directly. 
 
Now the issue here is, I have two diff VF pages for my leads. When the lead status is Open_not contacted & open-suspended, then he/she will be shown the "LeadPage" VF page & when the lead status is Working Contacted, he will be shown the "LeadDetails" VF page. Both these pages have the related list to create new task. 


I wrote the button func as - 
/00T/e?who_id={!Lead.Id}&retURL=%2Fapex%2FLeadDetails%3Fid%3D{!Lead.Id}%26nooverride%3D1&RecordType=0126xxxxxxxxx&ent=Task
 
How can I make the custom button dynamic in a way that it will redirect to the page from where it was moved from? Can I get some help in this? Do I need to write an Onclick JS button instead of Custom URL? 

Hello friends,
I have two record types in my task object - one for my leads & another one for opportunity. Whenever users try to create a new task from a lead/opportunity related list, he/she is shown a choice to select any one of these record types and the respective page will opens up for the creation of the task. This is little cumbersome as they may end up choosing an irrelevant record type at times.  As a solution, I am trying to create a custom list button with content source as URL passing the record type there -  as this will redirect to the concerned page layout directly. 

Now the issue here is, I have two diff VF pages for my leads. When the lead status is Open_not contacted & open-suspended, then he/she will be shown the "LeadPage" VF page & when the lead status is Working Contacted, he will be shown the "LeadDetails" VF page. Both these pages have the related list to create new task. 

I wrote the button func as - 

/00T/e?who_id={!Lead.Id}&retURL=%2Fapex%2FLeadDetails%3Fid%3D{!Lead.Id}%26nooverride%3D1&RecordType=0126xxxxxxxxx&ent=Task

How can I make the custom button dynamic in a way that it will redirect to the page from where it was moved from? Can I get some help in this? 

Hello Pals,
I am working on moving a managed package to AppExchange. I have made the required code level changes to satisfy AppExchange standards. FYI, my managed package is built in a DE org. I was told to change this DE org to Partner Portal Edition and it’s done. Now my package lies in this Partner portal edition. Can someone help me understand, what are the next steps in moving this Managed Package successfully to AppExchange? I tried getting the info from this forum and few other blogs, but I am little confused with the process. Step-by-step detailed guidelines will be really helpful.

What is Environmental Hub? How having this enabled will make sense here? What is Business Org? Do I need to have credentials from my business for Business Org to create a dev/test org for this? Lot many questions are running through my mind. Can someone help giving me a clear picture to proceed further with my deployment to AppExchange, please?
 
I am trying to tag emails to appear as "high importance" when an email is shot from my Salesforce system to a user. I found that this feature is not available in Salesforce as of now and the ideas are posted.

So I am trying to do something similar to this - when a user gets an email from the Salesforce (once the record satisfying few criteria) due to a WF rule, the email subject line should be highlighted (with different color like red or bold etc.,) just to differentiate it from the other emails in the inbox so that users are not going to miss it. Can we give a color coding in HTML Email template for the Subject line? How to achieve this?
 
Thank you!  

I am trying to tag emails or appear as "high importance" when an email is shot from my Salesforce system to a user. I found that this feature is not available in Salesforce as of now and the ideas are posted.

All I need to do is when a user gets an email from the Salesforce (once the record satisfying few criteria), the email subject line should be highlighted (with different color like red or bold etc.,) just to different if from the others so that users are not going to miss it. How to achieve this?

Thank you!  

In my present system, I have a VF page for my Lead home page from where the user views the lead list. And when he clicks a lead (Open Not contacted status), he will be taken to second VF page where he can see the primary details of the lead which are just a read-only. From here the user clicks a custom button to log his call outcomes when he gets a positive response, which in turn triggers the lead status change. I have page redirect utility class which helps the user to navigate to the custom lead details page now. All works well now.

Now I built a lead status trigger when a task field (picklist value) is inserted/ updated using process builder flow. I am triggering the lead status change from an update in the task object. Is there a way in process builder to do a page change/ navigation as well when there is a change in lead status? or Do I need to achieve this through code?  Reason for this is, for Open-Not contacted leads i have a complete custom page to show to the user and when the lead move to Working contacted status I need to show him a different page. Can anyone help me with this?     

I am trying to check the status of Lead while updating a task field. My requirement is, I need to check the lead status while creating a task for the concerned lead. The task subjects are mapped to the lead status. And once the lead reaches a Working-Contacted status the Trigger should not update the lead status further and just to add the task entry to the lead. When I try to do an entry, system throws me an error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY.  And Below is the trigger for the same. Please help me if I miss something here.

 for(task t : trigger.new)
    {
        if(t.whoid!=null && string.valueof(t.whoid).startsWith('00Q'))
        {
           //system.debug('test_1 for status' +Trigger.oldMap.get(t.whoid).Status );
           
           if(t.Call_Disposition__c == 'Wrong Number'||t.Call_Disposition__c == 'Number Busy'||t.Call_Disposition__c == 'Person Busy')
      
               {
                   if(!Trigger.oldMap.get(t.whoid).Status.contains ('Working - Contacted'))
                   {
                    leadtoupdate.add(new lead(id=t.whoid,status='Open - Not Contacted'));
                    system.debug('test for status' +Trigger.oldMap.get(t.whoid).Status );   
                   }
               }  
if(Call_Disposition__c == 'Call Again Later'||t.Call_Disposition__c == 'Follow-up On a Later Date'||t.Call_Disposition__c == 'Schedule a Call'')   
               {
                    leadtoupdate.add(new lead(id=t.whoid,status='Working - Contacted'));
               }     
}
 update leadtoupdate;

}

I have a trigger on Task object (events:  before insert, after insert, after update). The functionality of this trigger is – I have a set of call outcomes that determines the Lead status, which is coded using controllers and VF page. These values are nowhere build in the database as field values and are controlled by code. For example, when the user calls a prospect and based on the call outcomes he/she enters, the lead status will be set – like if it is “Number busy” the status remains as Open-Not Contacted, “Not interested” the status moves to Open-Suspended, “Interested” means “Working-Contacted”. And this outcomes are created as a “completed task” in to the Task object’s Activity History.


Now I am integrating a third party tool for Click-to-call functionality. This app gives me a handle to do same functionality in name of “Call dispositions”. Call dispositions is a custom picklist field in Activity. Now my requirement is –

  1. I need to trigger my lead status with this Call disposition i.e. each set of disposition should correspond to each status. And this functionality should not affect the earlier code that is append running in the system.
I need to combine both the logics in the same trigger working seamlessly. Any idea?
 
I have a profile "abc" which has no access to create a lead but can edit a lead. Now a user under profile "xyz" manually shares a lead to a person under "abc" profile. Here I have two questions - 

1.  Can the person (under ABC profile) to whom the lead is shared be notified via email? If so how can I make this dynamic? How to set the Email template for this?
2. Can the person (under ABC profile) to whom the lead is shared, unshare the lead once he is done acting on the particular lead? Else only the person who shared can do this?

How to achieve these? 
I'm trying to build [Change] link next to record owner name on the lead VF page so that the user can re-assign the leads. My lead VF page is a completely custom build page. I'm expecting this functionality to work as in Standard page ie., when the user clicks the [Change] link he/she should be taken to the change ownership page from where he/she should re-assign the lead and the retUrl should take him/her back to the custom page.

I have used the below piece of code found in this forum - 
<apex:outputLink value="{!URLFOR($Action.Lead.ChangeOwner,Lead.id)}">[Change]</apex:outputLink>

But it's not working as expected. When I add this code and tested by clicking the output link [Change] it asks me to log in again and gives me an error as - 
Stale Session Exception
The page you submitted was invalid for your session. Please try your action again. 

Can I get some help here? 
Hi,

I wrote a trigger to update a field (boolean value) in LEAD when an TASK is added to the lead. Trigger works fine in DEV box but when I deploy it, its giving me Exception error clashing with someother cls in production. I have added both the codes here. Please help me resolve this.

The trigger is below - 

trigger triggerOnLead on Task ( after insert, after update) {
 
    List<Id> leadIds=new List<Id>();

    for(Task t : Trigger.new)
    {

       leadIds.add(t.whoid);
       //system.debug('test' +leadIds);
    }   
       List<Lead> leadList = [Select id, status, isActivity__c from Lead where id =:leadIds and status='Open - Not Contacted' and isActivity__c=false ];
       
       for(Lead l:leadList )
       {
            l.isActivity__c = true;
       }
       
       try{
            update leadList;
          }
       catch(DMLException e){
            system.debug('Lead Activity is not updated properly!.  Error: '+e);
        }
 }

And I'm getting ERROR when deploying:
System.LimitException: Too many SOQL queries: 101
Stack Trace: Trigger.sampleTrigger: line 10, column 1

And it's clashing with trigger -

trigger sampleTrigger on Event(after insert) {

  string sWhtId = trigger.new[0].WhatId;
  string sWhoId = trigger.new[0].WhoId;
  Event objT = [Select id,WhatId,WhoId from Event where id =: trigger.new[0].id ];
 
  if(sWhtId != '')
  {
 
    List<Account>lstAcc = [Select id,LastModifiedById,ownerid from Account where id =: sWhtId ];
    if(lstAcc != null && lstAcc.size()>0)
    {
     if (trigger.new[0].LastModifiedById != null)
     {
      if(lstAcc[0].ownerid != trigger.new[0].LastModifiedById)
      {
        trigger.new[0].IsOwnerSame__c = true;
      }
     }
    else
    {
      if(lstAcc[0].ownerid != trigger.new[0].CreatedById)
      {
        objT.IsOwnerSame__c = true;
      }
    }
    }
    
  }

if(sWhoId != '')
  {
    //Contact
    List<Contact>lstCon = [Select id,LastModifiedById,ownerid from Contact where id =: sWhoId ];
    if(lstCon != null && lstCon.size()>0)
    {
     if (trigger.new[0].LastModifiedById != null)
     {
      if(lstCon[0].ownerid != trigger.new[0].LastModifiedById)
      {
        trigger.new[0].IsOwnerSame__c = true;
      }
     }
    else
    {
      if(lstCon[0].ownerid != trigger.new[0].CreatedById)
      {
        objT.IsOwnerSame__c = true;
      }
    }
    }
  }
 
}
Hello Friends,

I've created a visualforce page for Lead which displays basic details of the lead/prospect from where the users/ sales person can work on.

Controller class: Leadview.cls
VF page: Leadview.page

In this VF page I need to add the "Open Activities" related list (that is there in the standard page of Lead) with only "New Task" button added to it. When the user clicks this "New task" button, the functionality to create a Task should work as standard.

Can anyone guide me to achieve this, please?

I am trying to check the status of Lead while updating a task field. My requirement is, I need to check the lead status while creating a task for the concerned lead. The task subjects are mapped to the lead status. And once the lead reaches a Working-Contacted status the Trigger should not update the lead status further and just to add the task entry to the lead. When I try to do an entry, system throws me an error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY.  And Below is the trigger for the same. Please help me if I miss something here.

 for(task t : trigger.new)
    {
        if(t.whoid!=null && string.valueof(t.whoid).startsWith('00Q'))
        {
           //system.debug('test_1 for status' +Trigger.oldMap.get(t.whoid).Status );
           
           if(t.Call_Disposition__c == 'Wrong Number'||t.Call_Disposition__c == 'Number Busy'||t.Call_Disposition__c == 'Person Busy')
      
               {
                   if(!Trigger.oldMap.get(t.whoid).Status.contains ('Working - Contacted'))
                   {
                    leadtoupdate.add(new lead(id=t.whoid,status='Open - Not Contacted'));
                    system.debug('test for status' +Trigger.oldMap.get(t.whoid).Status );   
                   }
               }  
if(Call_Disposition__c == 'Call Again Later'||t.Call_Disposition__c == 'Follow-up On a Later Date'||t.Call_Disposition__c == 'Schedule a Call'')   
               {
                    leadtoupdate.add(new lead(id=t.whoid,status='Working - Contacted'));
               }     
}
 update leadtoupdate;

}

I have a trigger on Task object (events:  before insert, after insert, after update). The functionality of this trigger is – I have a set of call outcomes that determines the Lead status, which is coded using controllers and VF page. These values are nowhere build in the database as field values and are controlled by code. For example, when the user calls a prospect and based on the call outcomes he/she enters, the lead status will be set – like if it is “Number busy” the status remains as Open-Not Contacted, “Not interested” the status moves to Open-Suspended, “Interested” means “Working-Contacted”. And this outcomes are created as a “completed task” in to the Task object’s Activity History.


Now I am integrating a third party tool for Click-to-call functionality. This app gives me a handle to do same functionality in name of “Call dispositions”. Call dispositions is a custom picklist field in Activity. Now my requirement is –

  1. I need to trigger my lead status with this Call disposition i.e. each set of disposition should correspond to each status. And this functionality should not affect the earlier code that is append running in the system.
I need to combine both the logics in the same trigger working seamlessly. Any idea?
 
I have a profile "abc" which has no access to create a lead but can edit a lead. Now a user under profile "xyz" manually shares a lead to a person under "abc" profile. Here I have two questions - 

1.  Can the person (under ABC profile) to whom the lead is shared be notified via email? If so how can I make this dynamic? How to set the Email template for this?
2. Can the person (under ABC profile) to whom the lead is shared, unshare the lead once he is done acting on the particular lead? Else only the person who shared can do this?

How to achieve these? 
I'm trying to build [Change] link next to record owner name on the lead VF page so that the user can re-assign the leads. My lead VF page is a completely custom build page. I'm expecting this functionality to work as in Standard page ie., when the user clicks the [Change] link he/she should be taken to the change ownership page from where he/she should re-assign the lead and the retUrl should take him/her back to the custom page.

I have used the below piece of code found in this forum - 
<apex:outputLink value="{!URLFOR($Action.Lead.ChangeOwner,Lead.id)}">[Change]</apex:outputLink>

But it's not working as expected. When I add this code and tested by clicking the output link [Change] it asks me to log in again and gives me an error as - 
Stale Session Exception
The page you submitted was invalid for your session. Please try your action again. 

Can I get some help here?