• Sagar Patil
  • NEWBIE
  • 370 Points
  • Member since 2016
  • 2X Salesforce Certified

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 45
    Replies
option to open detail page of the records returned in search.

this is my vf page
<apex:page showChat="false" sidebar="false" controller="book4">
<apex:form >
  <apex:pageblock >
   <apex:pageblockButtons location="top" >
          <apex:commandButton value="search" action="{!search}"/>
          </apex:pageblockButtons>
         <apex:pageBlockSection title="book">
         <apex:inputText value="{!N1}"/>
         <apex:pageBlockTable var="a" value="{!Bk1}">
          <apex:column value="{!a.name}"/ >
          
          </apex:pageBlockTable>
          </apex:pageBlockSection>
      </apex:pageblock>
   </apex:form>
  </apex:page>


and this is my controller


public with sharing class book4 {

    public  list<Book__c> Bk1 { get; set; }
 public String N1 {get;set;}
 
  public book4() {
  
  Bk1 = new list<Book__c>();
  }
  
  public void search(){
  
    
     Bk1 = [select Name from Book__c where Name LIKE:('%'+N1+'%')];
    
    
    }

}

Hello All,

I need formula help! I have 3 custom dependent picklist fields on my Contact Object:

1. How contact data found?
2. What Show Team?
3. What competitor Show?

These are linked up in dependent picklists, which works as follows:
IF the answer to 1 is "Competitor Show" then the user has to specificy what show team they are from in field 2 "Labels OR Aerospace", then depending on what answer they give determines what values they can choose in field 3, "what competitor show?".

I need a validation rule formula that will do the following:

Competitor show is only 1 of 10 values available in field 1.  IF the answer to field 1 is Competitor Show then they have to have an answer in both 2 and 3.

Does anyone know how i would write this formula?

Thank you all in advance!!

Ella 

I am trying to build an advanced formula field that will calculate a total from some pick list fields I have on my lead page in a sandbox, I have 4 controlling pick list fields with 6 possible choices in each and each of them has a dependent pick list field with a scale of 5 - 0 points that defaults based on the choice in the controlling field associated with it.  The associated dependent pick list field is the one I need to use to add together to get the total.  Any help would be appreciated.

Screen shot of lead pageNameType                                         
Capability Match with Needs (Controlling)            
Capability Match Likert scale (Dependent)             
Timeline/Pricing Likert scale   (Dependent)           
Timeline/Pricing Expectations (Controlling)             
Clarity of request Likert scale  (Dependent)            
Clarity of Request  (Controlling)                           
Funding Info Likert Scale (Dependent)                   
Funding Information  (Controlling)                          
Hello Community,
 I'm Working on the Bulk Apex Triggers Trailhead and its throwing me the following error.
Question:
Create an Apex trigger for Opportunity that adds a task to any opportunity set to 'Closed Won'.
To complete this challenge, you need to add a trigger for Opportunity. The trigger will add a task to any opportunity inserted or updated with the stage of 'Closed Won'. The task's subject must be 'Follow Up Test Task'.
The Apex trigger must be called 'ClosedOpportunityTrigger'
With 'ClosedOpportunityTrigger' active, if an opportunity is inserted or updated with a stage of 'Closed Won', it will have a task created with the subject 'Follow Up Test Task'.
To associate the task with the opportunity, fill the 'WhatId' field with the opportunity ID.
This challenge specifically tests 200 records in one operation.
Here is my code:
trigger ClosedOpportunityTrigger on Opportunity (after insert,after update) {
    List<task> tasktoInsert = new List<task>();
    for(Opportunity opp : Trigger.New){
        if(opp.stageName == 'Closed Won'){
        Task t = new task();
        t.subject = 'Follow Up Test Task';
         t.WhatId = 'opp.Id';
            tasktoInsert.add(t);
        }
    }
    if(tasktoInsert.size()>0) {
        insert tasktoInsert ;
    }
}

 Error:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClosedOpportunityTrigger: execution of AfterInsert caused by: System.StringException: Invalid id: opp.Id Trigger.ClosedOpportunityTrigger: line 7, column 1: []

Hope you guys can help me.
Thanks in advance,
Mounika.
Hi All,

Can anybody please let me know how many levels of parents can we pull the data using formula field. For your reference below is the example.

parent__r.Parent__r.Parent__r ........?

Regards,
​VSK98
  • April 03, 2018
  • Like
  • 0
Hi All,

Can we Insert more than 50K account records in trigger. If possible, please expalin with small snippet code.

Regards,
VSK98
  • April 03, 2018
  • Like
  • 0
Hi Guys,
Please give the test class for the following class

​Public class getAccounts{

private String getAccountRecords(String AccuntId, String accountFor){
String recordId;
List<Account> accList =[Select id,Name,phone,Email from Account LIMIT 1];

if(!accList.isEmpty()){
recordId = accList[0].id;
    }

    return recordId;
    }
}
Hi,

I have an account field(lookup field to account) and a user lookup field called ALO  on contact object . What I want  to do is to find out the account name field value on contact object, traverse that account , fetch the owner id and then assign that to the ALO field on the contact object.

This is what I have written in my apex controller but I am getting some syntax error maybe because of the API names that I am using. Can anybody help please?

public Account acc {get; set;}

     acc = [
                        
                        SELECT Id, OwnerId
                        FROM Account
                        WHERE Id =: contact.Account
                        ];
                        
               contact.ALO= acc.OwnerId;

where 'contact' is the current contact instance.
I need a validation rule that states that if a checkbox is checked, two picklists and one user lookup must be filled out. The problem with what I created is that even though I select an option for both picklists and choose a user, I still get my error message. Here is the code:
AND( 
 My_checkbox__c = TRUE, 
 OR( 
 ISPICKVAL(My_first_picklist__c, ""), 
 ISPICKVAL(My_second_picklist__c, ""), 
 NOT(ISNULL(My_user__c)) 
 ) 
)
What am I doing wrong?
In the Context Variable Considerations section of the Apex Developer Guide it is stated that for a before delete trigger:
Can update original object using an update DML operation: Allowed. The updates are saved before the object is deleted, so if the object is undeleted, the updates become visible.

Yet, the code below results in the exception System.FinalException: Record is read-only

Any ideas on how to accomplish this (Waypoint__c is a custom object from one of the trails modules. I added the text field field3__c to it)?
if(Trigger.isDelete)
        {
           
            List<Waypoint__c> lw = new List<Waypoint__c> {};
			for(Waypoint__c w : trigger.old)
            {
                lw.add(w);
            }
            for(Waypoint__c w : lw)
            {
                w.Field3__c = 'BeforeDel';
            }
            
            update lw;
  	}

 
  • March 14, 2018
  • Like
  • 0
Hi Everyone !

We want to make a validation rule on the Object "Opportunity", the rule is basically:

We want to check the profile of the user editing the opportunity :
If the profile is Sales User/CSE/Technician/Project manager user/Sales & services
And the stage of the opportunity he want to put is :
Verbal / Contract / Launched / Invoiced / Closed

So if all this is gathered, an error message is displayed:"You can't change the stage with this profile."

Here is the formula i put on the validation rule :
AND( 
$Profile.Name = "Sales User", 
$Profile.Name = "CSE", 
$Profile.Name = "Technician", 
$Profile.Name = "Project Manager User", 
$Profile.Name = "Sales & Service", 
ISCHANGED(StageName), 
OR( 
text(StageName) = "Contract", 
text(StageName) = "Launched", 
text(StageName) = "Invoiced", 
text(StageName) = "Verbal", 
text(StageName) = "Closed" ))
And no error message when i try this from the profile i list and the stage i list too, please someone can help ?

Thanks !




 
Hello Developers,

I am writing small method in apex class which will use in lightning component. I am following lightning syntax still I am getting compile error. PFB the code snippet which throwing the error.
 
@AuraEnabled public Contact cont{get;set;} 
​@AuraEnabled
 public static id getDetails(){
     Id aa='sss';
     System.debug('caseObjh.Order:::>'+cont.Order_Num__c);
     return aa;
  }
I have referred below link still don't have any clue on this error.
https://salesforce.stackexchange.com/questions/172265/can-we-access-auraenabled-variables-in-auraenabled-methods?rq=1
 
Can you please help me.  Thanks

Regards,
Sagar
 
Hi Developers,

What is the <apex:outputpanel> correspondence tag in lightning framework.
For ex.
<apex:outputPanel id="xxxx" styleClass="scrollClass">
 </apex:outputpanel>
Please help!!!
Hello Developers,

If anyone has done/knows about migration from classic code to Lightning component, requesting you to suggest the way.

I would appreciate any help.

Regards,
Sagar
My question is: When ever lead is inserted, with leadsource as web set wilson as owner of record. If the leadsource is other than web then assign it to lifeQueue as owner.

Ans:

public class Lead_Example {
    
    User u= [Select id from User where FirstName LIKE 'wilson'];
    group g= [Select id from Group where type='Queue' and name='LifeQueue'];
    public static void callMe(List<Lead> leads) 
    {
        for(Lead l: leads)
        {
            if(l.LeadSource=='web')
            {
                l.OwnerId= u.id;
            }else{
                l.OwnerId=g.id;
            }
        }
    }
}

Trigger Callout:
trigger Lead_Example on Lead (before insert) {
    List<Lead> leads=Trigger.new;
    
    Lead_Example.callMe(Trigger.new);
    
}
option to open detail page of the records returned in search.

this is my vf page
<apex:page showChat="false" sidebar="false" controller="book4">
<apex:form >
  <apex:pageblock >
   <apex:pageblockButtons location="top" >
          <apex:commandButton value="search" action="{!search}"/>
          </apex:pageblockButtons>
         <apex:pageBlockSection title="book">
         <apex:inputText value="{!N1}"/>
         <apex:pageBlockTable var="a" value="{!Bk1}">
          <apex:column value="{!a.name}"/ >
          
          </apex:pageBlockTable>
          </apex:pageBlockSection>
      </apex:pageblock>
   </apex:form>
  </apex:page>


and this is my controller


public with sharing class book4 {

    public  list<Book__c> Bk1 { get; set; }
 public String N1 {get;set;}
 
  public book4() {
  
  Bk1 = new list<Book__c>();
  }
  
  public void search(){
  
    
     Bk1 = [select Name from Book__c where Name LIKE:('%'+N1+'%')];
    
    
    }

}

Hello All,

I need formula help! I have 3 custom dependent picklist fields on my Contact Object:

1. How contact data found?
2. What Show Team?
3. What competitor Show?

These are linked up in dependent picklists, which works as follows:
IF the answer to 1 is "Competitor Show" then the user has to specificy what show team they are from in field 2 "Labels OR Aerospace", then depending on what answer they give determines what values they can choose in field 3, "what competitor show?".

I need a validation rule formula that will do the following:

Competitor show is only 1 of 10 values available in field 1.  IF the answer to field 1 is Competitor Show then they have to have an answer in both 2 and 3.

Does anyone know how i would write this formula?

Thank you all in advance!!

Ella 

Hi All,
 
I have a requirement where I have two profiles, say Profile A and Profile B.
Profile A has certain permissions regarding objects, fields etc. Profile B has separate set of permissions.
The requirement is to make Make
Profile B permissions= Profile A permissions+ initial Profile B permissions.
 
Please let me know if anybody has worked on any such requirement and solution approach.
 
Thanks.
Hi all,

I have one picklist filed  "Priority " with values low, medium, high, urgent.
when the record is created that  Priority should be low .Inorder to ensure that I need to validate that by using validation rule whether the user created the record with the Low value only ,it should not be null /medium/high/urgent.
Could anyone please give me the logic for this?
 
I am trying to build an advanced formula field that will calculate a total from some pick list fields I have on my lead page in a sandbox, I have 4 controlling pick list fields with 6 possible choices in each and each of them has a dependent pick list field with a scale of 5 - 0 points that defaults based on the choice in the controlling field associated with it.  The associated dependent pick list field is the one I need to use to add together to get the total.  Any help would be appreciated.

Screen shot of lead pageNameType                                         
Capability Match with Needs (Controlling)            
Capability Match Likert scale (Dependent)             
Timeline/Pricing Likert scale   (Dependent)           
Timeline/Pricing Expectations (Controlling)             
Clarity of request Likert scale  (Dependent)            
Clarity of Request  (Controlling)                           
Funding Info Likert Scale (Dependent)                   
Funding Information  (Controlling)                          
User Object has Records and Custom Object[Emp] has no records in it. User object has records in it, so we can't create a master detail relation.Created lookup relation, Then try to convert look up to master by clicking on change field type there is no master detail option to select.
emp Object has below fields.
User-added image
public static void accountOptyCount(List<Opportunity> optyList){
        List<Account> accList=new List<Account>();
        Set<Id> optyIds = new Set<Id>();        
        For(Opportunity op:optyList){
           optyIds.add(op.AccountId);
           System.debug('optyIds List=======>: '+optyIds); 
        }
        accList=[SELECT Id,optyCount__c,(SELECT Id from Opportunities) from Account where Id in:optyIds];
        System.debug('accList List=======>: '+accList);
        For(Account a:accList){
            a.optyCount__c=a.Opportunities.size();
            System.debug('Opportunity count=======>: '+a.optyCount__c);
           /* Decimal sum=0;
            For(Opportunity opp:a.Opportunities){                
                sum=sum+1;
                System.debug('Sum=======>: '+sum);
            }
            a.optyCount__c=sum; */
        }
        update accList;
    }
===========
If(Trigger.isBefore && Trigger.isInsert){        
        Opportunity_Trigger_handler.accountOptyCount(Trigger.new);}
Hello Developers,

I am writing small method in apex class which will use in lightning component. I am following lightning syntax still I am getting compile error. PFB the code snippet which throwing the error.
 
@AuraEnabled public Contact cont{get;set;} 
​@AuraEnabled
 public static id getDetails(){
     Id aa='sss';
     System.debug('caseObjh.Order:::>'+cont.Order_Num__c);
     return aa;
  }
I have referred below link still don't have any clue on this error.
https://salesforce.stackexchange.com/questions/172265/can-we-access-auraenabled-variables-in-auraenabled-methods?rq=1
 
Can you please help me.  Thanks

Regards,
Sagar
 
Hello Community,
 I'm Working on the Bulk Apex Triggers Trailhead and its throwing me the following error.
Question:
Create an Apex trigger for Opportunity that adds a task to any opportunity set to 'Closed Won'.
To complete this challenge, you need to add a trigger for Opportunity. The trigger will add a task to any opportunity inserted or updated with the stage of 'Closed Won'. The task's subject must be 'Follow Up Test Task'.
The Apex trigger must be called 'ClosedOpportunityTrigger'
With 'ClosedOpportunityTrigger' active, if an opportunity is inserted or updated with a stage of 'Closed Won', it will have a task created with the subject 'Follow Up Test Task'.
To associate the task with the opportunity, fill the 'WhatId' field with the opportunity ID.
This challenge specifically tests 200 records in one operation.
Here is my code:
trigger ClosedOpportunityTrigger on Opportunity (after insert,after update) {
    List<task> tasktoInsert = new List<task>();
    for(Opportunity opp : Trigger.New){
        if(opp.stageName == 'Closed Won'){
        Task t = new task();
        t.subject = 'Follow Up Test Task';
         t.WhatId = 'opp.Id';
            tasktoInsert.add(t);
        }
    }
    if(tasktoInsert.size()>0) {
        insert tasktoInsert ;
    }
}

 Error:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClosedOpportunityTrigger: execution of AfterInsert caused by: System.StringException: Invalid id: opp.Id Trigger.ClosedOpportunityTrigger: line 7, column 1: []

Hope you guys can help me.
Thanks in advance,
Mounika.

HI I am having three picklist values.
A. Stage, B. Spend Margin, C.New Account.
Both Spend Margin and New Account are picklist values.
Picklist values for Spend Margin : Master Card & Visa Card
Picklist Values for New Account: Amex & Chase

If the stage is Close out the two picklist field values should have some picklist values in it.

Thanks for the responce.

 

Hi all,
is there a declarative way to share a standard object's record with an end date? I would like to share an Opportunity or a Contact with someone else (with the same profile that I have) and this sharing rule shall be revoked automagically once end date is reached.
Will process builder be able to fulfill this requirement or shall I use Apex code?

Thanks in advance,
Stefano
Hi All,

Can anybody please let me know how many levels of parents can we pull the data using formula field. For your reference below is the example.

parent__r.Parent__r.Parent__r ........?

Regards,
​VSK98
  • April 03, 2018
  • Like
  • 0
Hi All,

Can we Insert more than 50K account records in trigger. If possible, please expalin with small snippet code.

Regards,
VSK98
  • April 03, 2018
  • Like
  • 0
Is it possible to create a trigger that will allow no one, except system administrators, to create two opportunities of the same type on the Account object?  So, if someone has already created an equipment opportunity, another person could not create another equipment opportunity on the account.  I had originally thought this would be a validation rule and now I have no idea what to do.  Please advise.