• Pavit Siddhu
  • NEWBIE
  • 139 Points
  • Member since 2017
  • Salesforce Developer

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 53
    Replies
How can i disable the IP range restrictions from a profile.
Currently i can see different IP ranges in that profile. If i delete all the IPs does it mean that there will
no IP restriction for that profile?
Hi All,
       i have a helper class which i am calling from Opportunity trigger.
      i want to made it generic so that i can call it from any trigger and it track the field history. right now i am not able to get the object in which the trigger is running
my trigger is given below:-
trigger Trigger_Opportunity on Opportunity (before insert, before update, before delete,
                                             after insert, after update, after delete) {
      OpportunityTriggerHelper.newOpportunity = trigger.new;
    OpportunityTriggerHelper.oldOpportunity = trigger.old;
    OpportunityTriggerHelper.newMapOpportunity = trigger.newMap;
    OpportunityTriggerHelper.oldMapOpportunity = trigger.oldMap;
                                                 
                                                 
     if( Trigger.isAfter ) {
        if(Trigger.isUpdate ){
       GenericTriggerClass.GenericClassMethod(trigger.oldMap, trigger.newMap); 
        }                                            
     }                                               
}
my helper is given below:-
public class GenericTriggerClass {
    public static List<SObject> newSObject = new List<SObject>();
    public static List<SObject> oldSObject = new List<SObject>();
    public static Map<Id, SObject> newMapSObject = new Map<Id, SObject>();
    public static Map<Id, SObject> oldMapSObject = new Map<Id, SObject>();
    
    public static void GenericClassMethod(Map<Id, SObject> oldMapSObject, Map<Id, SObject> newMapSObject){
        List<History_Tracking__c> historiesToInsert = new List<History_Tracking__c>();
        for(SObject sObj : newMapSObject.values()){
            SObject OldsObj = oldMapSObject.get(sObj.Id);
            System.debug('con'+sObj);
            System.debug('oldCon'+OldsObj);
            for (String sObjField : SObjectHistory()) {
                
                History_Tracking__c sObjHistory = createUpdateHistory(sObjField, oldsObj, sObj);
                historiesToInsert.add(sObjHistory);
                System.debug('ConHistory'+sObjHistory);
                 System.debug('histories'+historiesToInsert);
            }
            
        }
        
        
        if(!historiesToInsert.isEmpty()) {
            List<History_Tracking__c> historiesToInsertWithoutDuplicates = new List<History_Tracking__c>();
            Set<History_Tracking__c> historiesSet = new Set<History_Tracking__c>();
            historiesSet.addAll(historiesToInsert);
            historiesToInsertWithoutDuplicates.addAll(historiesSet);
            
            insert historiesToInsertWithoutDuplicates;
            System.debug('ConRecord'+historiesToInsertWithoutDuplicates);
        }
    }
     private static History_Tracking__c createUpdateHistory(String field, SObject oldsObj, SObject newsObj) {
        History_Tracking__c      sObjHistory = new History_Tracking__c();
        sObjHistory.FieldName__c = field;
        sObjHistory.ObjectName__c = oldsObj.Id.getSObjectType().getDescribe().getName();

        sObjHistory.ObjectId__c = oldsObj.Id;
        String oldValue = String.ValueOf(oldsObj.get(field));
        String newValue = String.ValueOf(newsObj.get(field));
        
        sObjHistory.OldValue__c = oldValue;
        sObjHistory.NewValue__c = newValue;
        if (sObjHistory.OldValue__c != null) sObjHistory.OldValue__c = sObjHistory.OldValue__c.abbreviate(255);
        if (sObjHistory.NewValue__c != null) sObjHistory.NewValue__c = sObjHistory.NewValue__c.abbreviate(255);
        return sObjHistory;
    }

    public static  List<String> SObjectHistory(){
        Map<String,FieldTracking__c> MapToFieldHistory = new Map<String,FieldTracking__c>();
        for(FieldTracking__c ft: [Select  Id, selectedField__c,Selectedobject__c 
                                  from FieldTracking__c 
                                  ]){
            MapToFieldHistory.put(ft.Selectedobject__c, ft);
            System.assert(FALSE,MapToFieldHistory);
        }
        FieldTracking__c ft = new FieldTracking__c();
        
        
        List<String> ListFieldTracking = new List<String>();
        String fieldValues =  String.valueOf(MapToFieldHistory.get(ft.Selectedobject__c).selectedField__c);
        //System.assert(FALSE,ft.Selectedobject__c);
        ListFieldTracking.addAll(fieldValues.split(','));
        return ListFieldTracking;
    }
 }
here at bold line i am not getting the particular object in which i am calling the trigger here like it should be opportunity
how to get the object?
​Any suggestion?/
  • September 05, 2018
  • Like
  • 0
Hi all,
please, I have a problem with the Use the data import wizard challenge:
I launch the wizard
1
After I check the right fileds:
2
But, I can't see the fileds in the screen, only a red unmapped:
4
If I try to map the fields in the challenge I have this error:
3
And the challenge say:
5
HELP please!!!

Many thanks in advanced
B RGDS
Adriano
Hi,
I have created a case assignment rule where whenever case of specific record type  is created it is assigned to a Queue.
But I'm not able to test it in test class. Kindly help me with the solution for this.
Hi All , 

Below is the code snippet  code which is highlighted in bold is not executing, i logged into to iphone then checked , code is not returning true for {!v.messages[0] can someone help pls , what wrong going through 

<aura:component >
    <aura:attribute name="messages" type="List"
                    default="['you look nice today.',
                              'Great whether we are having.',
                              'How are you?']"/>
    
    <h1> Hello Playground</h1>
    <p> Silly fun with attributes and expressions</p>
    <br></br>
    <h2> List Items</h2>
    <br></br>
    <p> <c:hellomessage message="{!v.messages[0]}"/> </p>
    <p> <c:hellomessage message="{!v.messages[1]}"/> </p>
    <p> <c:hellomessage message="{!v.messages[2]}"/> </p>
     <br></br>
    <h2> List iteration </h2>
    <br> </br>
    <aura:iteration items="{!v.messages}" var="msg">
        <p> <c:hellomessage message="{!msg}"/> </p>
    </aura:iteration>
     <br></br>
    <h2> conditional Expressions and Global value providers</h2>
    <br></br>
    <aura:if isTrue="{!$Browser.isIPhone}">
        <p> <c:hellomessage message="{!v.messages[0]}"/> </p>
    <aura:set attribute="else">
        <p> <c:hellomessage message="{!v.messages[1]}"/>  </p>    
    </aura:set>
    </aura:if>

</aura:component>
<apex:page standardController="Account" extensions="AddCampaignControllerExtension" recordSetVar="Accounts">
    <apex:includeLightning />
    <div id="lightning" style="height:150px;"/>
public with sharing class AddCampaignControllerExtension{
	public List<Account> selectedList{ get; set; }    
    ApexPages.StandardSetController setCon;

    public AddCampaignControllerExtension(ApexPages.StandardSetController controller)
    {
        setCon = controller;
        List<Account> selectedList = setCon.getSelected();

I have these code bits. I have posted only the relevant bits. I am using a visualforce page with a standardcontroller and also an extensioncontroller (standardSetcontroller). My problem is that getSelected is not filling out the selected values from my list view.

Anyone have any help or pointers I would be very glad. Thanks in advance!

Hi,
I have a lightning component which has started giving below compile error for User.ContactId Field referenced in the apex controller.

Failed to save VV_Circles.cmp : Invalid definition for null: VV_BookingsController: SELECT ID, ContactId FROM User LIMIT 1 ^ ERROR at Row:1:Column:12 No such column 'ContactId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

The lightning component was working fine till Spring 19 release was rolled out in the Development sandbox. 

This issue has also impacted the Community Builder Page where this component is being used and causing internal server error in Community Builder.
An internal server error has occurred Error ID: 1138818950-215153 (403527751)

Please provide your suggestions for this issue.
How can i disable the IP range restrictions from a profile.
Currently i can see different IP ranges in that profile. If i delete all the IPs does it mean that there will
no IP restriction for that profile?
Hi All,
       i have a helper class which i am calling from Opportunity trigger.
      i want to made it generic so that i can call it from any trigger and it track the field history. right now i am not able to get the object in which the trigger is running
my trigger is given below:-
trigger Trigger_Opportunity on Opportunity (before insert, before update, before delete,
                                             after insert, after update, after delete) {
      OpportunityTriggerHelper.newOpportunity = trigger.new;
    OpportunityTriggerHelper.oldOpportunity = trigger.old;
    OpportunityTriggerHelper.newMapOpportunity = trigger.newMap;
    OpportunityTriggerHelper.oldMapOpportunity = trigger.oldMap;
                                                 
                                                 
     if( Trigger.isAfter ) {
        if(Trigger.isUpdate ){
       GenericTriggerClass.GenericClassMethod(trigger.oldMap, trigger.newMap); 
        }                                            
     }                                               
}
my helper is given below:-
public class GenericTriggerClass {
    public static List<SObject> newSObject = new List<SObject>();
    public static List<SObject> oldSObject = new List<SObject>();
    public static Map<Id, SObject> newMapSObject = new Map<Id, SObject>();
    public static Map<Id, SObject> oldMapSObject = new Map<Id, SObject>();
    
    public static void GenericClassMethod(Map<Id, SObject> oldMapSObject, Map<Id, SObject> newMapSObject){
        List<History_Tracking__c> historiesToInsert = new List<History_Tracking__c>();
        for(SObject sObj : newMapSObject.values()){
            SObject OldsObj = oldMapSObject.get(sObj.Id);
            System.debug('con'+sObj);
            System.debug('oldCon'+OldsObj);
            for (String sObjField : SObjectHistory()) {
                
                History_Tracking__c sObjHistory = createUpdateHistory(sObjField, oldsObj, sObj);
                historiesToInsert.add(sObjHistory);
                System.debug('ConHistory'+sObjHistory);
                 System.debug('histories'+historiesToInsert);
            }
            
        }
        
        
        if(!historiesToInsert.isEmpty()) {
            List<History_Tracking__c> historiesToInsertWithoutDuplicates = new List<History_Tracking__c>();
            Set<History_Tracking__c> historiesSet = new Set<History_Tracking__c>();
            historiesSet.addAll(historiesToInsert);
            historiesToInsertWithoutDuplicates.addAll(historiesSet);
            
            insert historiesToInsertWithoutDuplicates;
            System.debug('ConRecord'+historiesToInsertWithoutDuplicates);
        }
    }
     private static History_Tracking__c createUpdateHistory(String field, SObject oldsObj, SObject newsObj) {
        History_Tracking__c      sObjHistory = new History_Tracking__c();
        sObjHistory.FieldName__c = field;
        sObjHistory.ObjectName__c = oldsObj.Id.getSObjectType().getDescribe().getName();

        sObjHistory.ObjectId__c = oldsObj.Id;
        String oldValue = String.ValueOf(oldsObj.get(field));
        String newValue = String.ValueOf(newsObj.get(field));
        
        sObjHistory.OldValue__c = oldValue;
        sObjHistory.NewValue__c = newValue;
        if (sObjHistory.OldValue__c != null) sObjHistory.OldValue__c = sObjHistory.OldValue__c.abbreviate(255);
        if (sObjHistory.NewValue__c != null) sObjHistory.NewValue__c = sObjHistory.NewValue__c.abbreviate(255);
        return sObjHistory;
    }

    public static  List<String> SObjectHistory(){
        Map<String,FieldTracking__c> MapToFieldHistory = new Map<String,FieldTracking__c>();
        for(FieldTracking__c ft: [Select  Id, selectedField__c,Selectedobject__c 
                                  from FieldTracking__c 
                                  ]){
            MapToFieldHistory.put(ft.Selectedobject__c, ft);
            System.assert(FALSE,MapToFieldHistory);
        }
        FieldTracking__c ft = new FieldTracking__c();
        
        
        List<String> ListFieldTracking = new List<String>();
        String fieldValues =  String.valueOf(MapToFieldHistory.get(ft.Selectedobject__c).selectedField__c);
        //System.assert(FALSE,ft.Selectedobject__c);
        ListFieldTracking.addAll(fieldValues.split(','));
        return ListFieldTracking;
    }
 }
here at bold line i am not getting the particular object in which i am calling the trigger here like it should be opportunity
how to get the object?
​Any suggestion?/
  • September 05, 2018
  • Like
  • 0

Dear All,

Here is my requirement

- Capture All of Approver comment of each step

- Display the previous approver and below the layer to the approver in email (For example if approver in step 4., He wants to see the comment from step 1 2 and 3 'without' open the SFDC record <--- This point I aim to capture the comment and send the email)

My problem is my very simple trigger works only at the end of the approval process with only lastest comment, I try to add 'Field Update' action to '1st Approvers Approve' but it's not working, Can anyone can suggest me or revise my code? (Maximum of my approval layer is 5)

Here is my very simple trigger

Note that copy_comment__c is a checkbox field to fire a trigger via the approval process

and Approver_Comment__c is a field to keep the comment (maybe I need to create 4 more of this fields to stamp all of 5 approver's comment)

trigger TriggerApprover on Quote (before update) {
    
       if(trigger.isUpdate){
             List<Quote> QuoList =  [Select id,
                                                   (Select Id, 
                                                         IsPending, 
                                                         ProcessInstanceId, 
                                                         TargetObjectId, 
                                                         StepStatus, 
                                                         OriginalActorId, 
                                                         ActorId, 
                                                         RemindersSent, 
                                                         Comments, 
                                                         IsDeleted, 
                                                         CreatedDate, 
                                                         CreatedById, 
                                                         SystemModstamp 
                                                    FROM ProcessSteps
                                                ORDER BY CreatedDate DESC) 
                                                    From Quote
                                                WHERE Id IN : Trigger.new];

             if(QuoList.size() > 0){

               for(Quote quo : QuoList){
              
                for(Quote quo1 : Trigger.new) {
                  
                         //check copy comment is true
                         if(quo.id == quo1.id && quo1.copy_comment__c ) {
 
                           if (quo.ProcessSteps.size() > 0) {
                            
                         quo1.Approver_Comment__c = quo.ProcessSteps[0].Comments;
                         quo1.copy_comment__c = false;
                
                           }

                        }
                 
                    }
               }
             }   
        }  
    }
Hello, 

How to refrech current page with apex code.
Thank you.
  • September 04, 2018
  • Like
  • 0
Actually i search it and read it.But i didn't get the what they say. please tell  me in simple to know crm process
Hi all,
please, I have a problem with the Use the data import wizard challenge:
I launch the wizard
1
After I check the right fileds:
2
But, I can't see the fileds in the screen, only a red unmapped:
4
If I try to map the fields in the challenge I have this error:
3
And the challenge say:
5
HELP please!!!

Many thanks in advanced
B RGDS
Adriano
Hi,
I have created a case assignment rule where whenever case of specific record type  is created it is assigned to a Queue.
But I'm not able to test it in test class. Kindly help me with the solution for this.
copy a record from one object to another when a field changes

I have an object test__c and test2__c

I want to fill in oject test with a field and have it go through an apporval process, once the approval has been completed it will set a field of status__c to approved,

What is the best method (is it using apex?) of taking the approved record from test__c to test2__c once status in test has changed to approved?

Thanks
Hi All,

We are trying to setup SalesforceDX in our company and I am stucked with a very basic understanding of the SalesforceDX architecture.
So Far we have Developer Sandbox for every developer. But from now on, we wish to have one developer sandbox and developers must create scratch orgs from this Developer Sandbox and when developer is done testing on QA Sandbox, then the changes are pushed to the production org.

In my understanding, to create a sratch org, user needs to login with Devhub org which is the production org. Every developer then needs to login with production login first to create the scratch org and then push the changes to VCS? Is my understanding correct here? If Devhub is enabled, why cannot we create scratch org from the developer sandbox? Could somebody explain the architecture? I tried to understand from different blogs but didnt get any substantial answer.

Thanks. Dev