• Veena Sundara-Heragu
  • NEWBIE
  • 60 Points
  • Member since 2016
  • Senior Salesforce Developer
  • OpFocus

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 30
    Replies
Hey everybody,

I'm running into a challenge that is probably very easy but I'm struggling with it. I need to write a SOQL query that will simple pull all Leads not attached to a Campaign. Here is what I've come up with so far but it is definitely not working...

SELECT Id, (Select Id From CampaignMembers WHERE Id = Null) FROM Lead WHERE CreatedDate >= 2016-03-13T00:00:00Z

When I go through the results, most of these are indeed attached to a campaign so not sure what I'm doing wrong.

Any ideas? Thanks in advance.
As many people are aware that the Campaign/Campaign Member objectin Salesforce is very limited with regards to history. Having looked on the Salesforce community, SFDC offer a work around in the form of a custom ibject and trigger to help monitor any amendment made to the member record (added or deleted).
However, where it falls short is that if a member is deleted then it references only the member id in the new record and not the Contact or Lead id.

Below is the following trigger. How do i get to populate the Contact__c  or Lead__c field if the Contact/Lead is added or deleted?
 
Trigger HistoryTrack on CampaignMember (after insert, before update, before delete)
 { List<CampaignHistory__c> ch= new List<CampaignHistory__c>(); List<CampaignMember> cmOld= Trigger.old;  List<String> changes  = new List<String>(); List<String> CampHisId  = new List<String>(); integer i=0; if(Trigger.isDelete){
            for(CampaignMember cm: Trigger.old ){     
                       String s;                            
                       s='Campaign Member id ' + cm.id +
                       '  has been deleted from campaign id:  '+ cm.campaignId + '   by user  '+ userinfo.getUserName();                                        
                       changes.add(s);
                       
                       CampHisId.add(cm.campaignId);
                       CampaignHistory__c c= new CampaignHistory__c();               
                       c.Name='History'+ DateTime.now();  
                       System.debug('CName:'+ c.Name);
                       c.User__c = userinfo.getuserId() ;
                       c.CampaignId__c = CampHisId[i];
                       System.debug('CampaignId:'+c.CampaignId__c);                              
                       c.HistoryDetails__c=changes[i];
                      System.debug('CHistory:'+c.HistoryDetails__c);         
                      ch.add(c);                              
                      i++;           
             } 
        }else {      
                     for(CampaignMember cm: Trigger.new ){  
                            String s;
                            if((Trigger.isUpdate)){
                                   if(cmOld[i].status!=cm.status){    
                                          s='on dated ' + DateTime.now() +                        
                                            ' status changed from ' + cmOld[i].status + ' to ' + cm.status +                        
                                            ' by user ' + userinfo.getUserName();
                                                                                       changes.add(s);
                                          CampHisId.add(cm.campaignId);                                                  
                                          CampaignHistory__c c= new CampaignHistory__c();                          
                                          c.Name='History'+DateTime.now();
                                          c.User__c = userinfo.getuserId() ;
                                          System.debug('CName:'+c.Name);
                                          c.CampaignId__c=CampHisId[i];                        
                                          System.debug('CampaignId:'+c.CampaignId__c);                                      
                                          c.HistoryDetails__c=changes[i];
                                          System.debug('CHistory:'+c.HistoryDetails__c);
                                          ch.add(c); 
                                      }else if(cmOld[i].campaignId!=cm.campaignId){                        
                                                s='Changed Campaign id from : '+ cmOld[i].campaignId + 'to :' + cm.campaignId +                        
                                                    ' by user '+ userinfo.getUserName();  
                                              changes.add(s);                        
                                          CampHisId.add(cm.campaignId);                                                            
                                          CampaignHistory__c c= new CampaignHistory__c();                           
                                          c.Name='History'+DateTime.now();
                                          System.debug('CName:'+c.Name); 
                                          c.User__c = userinfo.getuserId() ;             
                                          c.CampaignId__c=CampHisId[i];                   
                                          System.debug('CampaignId:'+c.CampaignId__c);                                          
                                          c.HistoryDetails__c=changes[i];
                                          System.debug('CHistory:'+c.HistoryDetails__c);                         
                                          ch.add(c);
                                         }             
                           }else if(Trigger.isInsert){                                
                                       s='A new Campaign Member id : ' + cm.id + ' has been added to Campaign id :' + cm.campaignId +                                                          ' by user '+ userinfo.getUserName();
                                       changes.add(s);                    
                                       CampHisId.add(cm.campaignId);                    
                                       System.debug('s>>>'+s);                                                                    
                                       CampaignHistory__c c= new CampaignHistory__c();
                                       c.Name='History'+DateTime.now();                   
                                       System.debug('CName:'+c.Name);
                                       c.CampaignId__c=CampHisId[i];
                                       c.User__c = userinfo.getuserId() ;
                                       System.debug('CampaignId:'+c.CampaignId__c);                                          
                                       c.HistoryDetails__c=changes[i];
                                       System.debug('CHistory:'+c.HistoryDetails__c);                                        
                                       ch.add(c);
                            } 
                            i++;     
                       }         
                }    
                insert ch;
     }

Thank you in advance for any help offered

Kind regards

Tom
Hi,
When I check challenge #7 of this superbadge, i see the following error:
User-added image
I am using a new DE org and do not wish to repeat everything I just did for this badge.  Please help!
Why do we use component custom event in Lightning, what are the use case of using custom component events.

Standard event like button click can do any work in lighting still we use custom components event, Please explain.

Thanks,
Parteek
Hi All
How can i create a custom component for EDIT action .so that i will remove specified field from layout ..

Thanks 
I'm passing a custom class wrapper from an apex controller to a Lightning​ component, then later send it back using JSON.Stringify(theWrapper). But the apex controller can't deserialize the wrapper, giving me the error above. I've narrowed it down to lookup fields somehow getting converted from a string of the id to a whole object while in the lightning component.
Basically, theObject.Lookup__c = '0000000000123'. From the apex controller, it can be read as {"theObject":{"Lookup__c":"0000000000123"}}.
But when passed back from the lightning component, it's read as {"theObject":{"Lookup__c":{"id":"0000000000123", "name":"Lookup record"}}}
I think it's unable to deserialize because it's no longer just a string.

For reference, I'm trying to deserialise like this:
@AuraEnabled
public static String upsertSelectedBooking (String sbwString){
        
    system.debug('sbwString: ' + sbwString);
        
    selectedBookingWrapper sbw = (selectedBookingWrapper)System.JSON.deserialize(sbwString, selectedBookingWrapper.class);

    //The rest
    //...
}

How should I go about handling this?

Hi All,

In my free developer account, Under the community section when I add a component with basic text box and other fields the component is visible in Community pages after publising the changes (I made the pages as public, so that every one can view with out logging in).

But when the component has some data like contacts which are being fetched from the Apex controller, I cannot see the same component once the changes are published. Please guide me

Regards,

Raghu
 

Hi All,

We have Quote as custom child object under Opportunity. On Opportunity Page layout - > Related list for Quote-> New Button is override by visualforce in classic. Using retURL, we are getting parent id i.e. opportunity id and we can do necessary business logic.

But in lightening, as we cannot use retURL , so we have override New button with Lightening Component with HasRecordId. But we are not able to get parent record id i.e. Opportunity. Does any one know solution on this? Please let us know any suggestion or comments. 

Regards
Laxman
Hi All,

I'm unable to deserialize a string even when the value is not null. Here is my code snippet.

​public static List<ObjectA> processSelected(String constr) {
        system.debug('constr===>'+constr);  //getting value in this
        List<dupeContact> conList = (List<dupeContact>)JSON.deserialize(constr, List<dupeContact>.class);
        system.debug('dupeContact====>'+conList);     
        List<ObjectA> selectedContacts = new List<ObjectA>();
        if (conList != null && conList.size() >0) { 
            for (dupeContact  cCon : conList) {
                if (cCon.selected == true) {
                    selectedContacts.add(cCon.con);
                }
            }
        }

Thanks in Advance  :)

Hello Everyone,

I am trying to add the Toast message to the lightning Component But its not working here is the my code of the Function.

deteteQuestion : function(component, event, helper){
        
        var action = component.get("c.delSlctRec");
        var idx = event.target.id;
        action.setParams({ "slctRec" : idx});
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
                        title: "Success!",
                        message: "Congrats, it works!",
                        type: "success"
                    });
        //var result = confirm("Are you sure you want to delete?");
       // if(toastEvent) {
            action.setCallback(this, function(response){
                var state =  response.getState();
                if(state === "SUCCESS")
                {
                    component.set("v.ques",response.getReturnValue());
                    
                    toastEvent.fire();
                    //document.getElementById("msg").innerHTML = "Record deleted successfully";
                    //alert('Successfully Deleted.');
                    // window.location.reload();
                    
                }else if (state=="ERROR") {
                    //console.log(action.getError()[0].message);
                    alert('error');
                }
            }); 
            
            $A.enqueueAction(action);
       // }
    },
Hi Community, 

i am working on the change of our javascript buttons so that we can use it in lightning.
Regarding to the readiness report i started to check each custom button which are not supported.
I noticed that some javascript button partically work in lightning.
The Recommendations of the readiness report are that lightning component should be used for this case. The javascript buttons which are partically work in lightning, opens an default/automatic generated windows  (e.g. button create a new opportunity out of contact) this window has the correct fields which i needed.
My question is where is this default window with the correct fields stored, can i copy the structure of it to build a lightning component?

Best regards

Hakan
Hi,
When I check challenge #7 of this superbadge, i see the following error:
User-added image
I am using a new DE org and do not wish to repeat everything I just did for this badge.  Please help!
I have created a trigger on attachment to prevent user from uploading .CSV file and showing an error message in classic, but when I switched in lightning interface and testing my trigger it is showing standard error message not showing trigger addError() message.

Please share your experience to resolve my problem

 
Hi
I have the following Lightning Component to save the record into Account Object.
It saves standard field (Acc Name, Description). But not Custom fields.

I want to add one picklist field and one lookup field on Component.

<!-- NewAccount -->
<aura:component implements="force:appHostable" controller="AccountController">
    <aura:attribute name="newAccount" type="Account" default="{ 'sobjectType': 'Account', 'Name': '', }"/>
    <div >
        <center>
            <form>
                <lightning:input aura:id="AccountName" name="New Account Name" label="Account Name"
                                 value="{!v.newAccount.Name}" required="true"/>
                <lightning:input aura:id="Description" name="New Account Name" label="Note"
                                 value="{!v.newAccount.Description}" required="true"/>
                <lightning:input aura:id="Categories" name="New Account Name" label="Categories"
                                 value="{!v.newAccount.Categories_del__c}" required="true"/>
                
                <lightning:select aura:id="myselection" value="{!v.selectValue}">
                    <aura:iteration items="{!v.options}" item="option">
                        <option value="{!option}">{!option}</option>
                    </aura:iteration>
                </lightning:select>
                
                <lightning:button label="Save" onclick="{!c.createAccount}" />
                
            </form>
        </center>
    </div>
</aura:component>


How to store Picklist and Lookup field ...?
Hi,
I am calling a method saveData from my js controller when all the fields of my form are filled :
$("#myForm").validate({
            rules: {
                title: {required: true},
                firstname: {required: true},
                lastname: {required: true},
            },
            messages: {
                title:  "Please type and select a title",
                firstname: "Please enter the client first name",
                lastname: "Please enter the clients last name",
            },   
            tooltip_options:{
                '_all_': {placement: 'top'},
            },
            focusInvalid: false,
            submitHandler: function() {
                if($('#confirmation').prop("checked") == false ){
                    helper.showErrorMessage();
                }else {
                    helper.saveData(component);
                }
            }
        });
    },

The callback of this method is never called - and when I open the developer tools , the callback function is called and working fine
saveData: function(component){
        var action = component.get("c.saveClient");
        actionJInsured.setParams({
            "firstname": firstname,
            "lastname": lastname,
            "title": "title"
        });
        action .setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                alert('inside the callback');
            }
        });
        $A.enqueueAction(action);
    }

does any one has an explanation of why the code is only working when open the developer tools in the browser please?

I am trying to create custom Related List button using Lightning Out VF page. The component loads fine however, when I click on the button it is opening in a new tab, Is there a way I can show it on the same page in a MODEL?User-added image
 
<!-- Load Lightning dependencies -->
<apex:includeLightning />

<div class="slds">
    <!-- Target div for the Lightning component -->
    <div id="customObjectEdit"></div>
</div>

<script>
var recordId = '{!lId}';

$Lightning.use("c:createLtgOutApp", function() {
    var attributes = {
        recordId: recordId
    };

    var targetElementId = 'customObjectEdit';

    $Lightning.createComponent('c:createLtgOut', attributes, targetElementId,
                               function(cmp) {
                                   // At this point the component has been created and loaded
                               });
});
</script>

 
  • August 23, 2017
  • Like
  • 0
Hi All,
We have a custom action button in lightning for Lead convert.
Issue is on clicking the convert button (custom) it does not display error message (for example status is mandatory etc). it simply refresh the page with the model box and lead does not convert.
In debug logs .. validation error message is there...
In Lead settings, Require Validation for Converted Leads is also Checked..

Please suggest!!
Thanks
Hi Team,
I am creating ContactSearchBar and ContactList as single component. On initialization of component am loading all the contacts to list after  in serach bar if i type any charachter am getting "Cannot read property 'value' of undefined"  error.Please find my snippet code
({
	doInit : function(component, event, helper) {
		  var action = component.get("c.findAllContactsList");
          action.setCallback(this, function(a) {
            component.set("v.Accounts", a.getReturnValue());
        });
        $A.enqueueAction(action);
	},
    ContactNameSearchKeyChange: function(component, event, helper) {
        var myEvent = $A.get("e.c:ContactSearchKeyEvent");
         
        myEvent.setParams({"searchKey": event.target.value});
        myEvent.fire();
          
    },
  
    ContactNameSearchKeyChange: function(component, event) {
    var searchKey = event.getParam("searchKey");
    var action = component.get("c.findByContactName");
    action.setParams({
      "searchKey": searchKey
    });
    action.setCallback(this, function(a) {
        component.set("v.contacts", a.getReturnValue());
    });
    $A.enqueueAction(action);
}
})

 
We have created a new case button and placed this custom button in the account related list.

Button Definition:
/500/e?retURL=%2F500%2Fo 
&cas4_lkid={!Account.Id} 
&CF00N0q000000GN5a={! $User.LastName } 
&RecordType=0120q00000007Aa

The above button is working for classic users but when switched to lightning experience this button is working and auto-populating other fields except for "Account ID".

What do we have to do for the above button populate "Account id" also in Lightning? 

 
Hi all,

I am running into the CPU time limit exceeded error when I try to bulk import data into our org. Because I don't have coding knowledge myself, I was hoping to use visual workflows instead. The data that we sync has up to 22 fields that have 0's and 1's for the field input and I want to change these into "Yes" and "No" picklist values. The reason that I didn't want to use a formula field is because sometimes we also manually create records and I wanted to be able to choose Yes/No values. I also couldn't use checkboxes as per the instructions I received. 

Here is process flow I created

User-added image

What I did is I created 22 action groups for each of the binary fields. The action group criteria was to check if the picklist value is a 0 or 1 and if so, it'll kick in the immediate actions.

Here is part of the error message I received below. It seems like it's running but it's just slow..? 
Flow Details
Flow Name: Listing_Workflow_for_Binary_Fields
Type: Workflow
Version: 3
Status: Active

Flow Interview Details
Interview Label: Listing_Workflow_for_Binary_Fields-3_pba__Listing__c
Current User: Keith Kiefer (005150000066qU6)
Start time: 1/22/2017 4:13 PM
Duration: 17 seconds

How the Interview Started
Keith Kiefer (005150000066qU6) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = a091500001MLez0AAD
RecursiveCountVariable = 0.00

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "1/22/2017 4:13 PM"

DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!formula_myRule_1} (true) Equals true
Logic: All conditions must be true (AND)

DECISION: myRule_1_pmetdec
Executed this outcome: myRule_1_pmetnullrule
Outcome conditions: or
1. {!myVariable_old} (null) Is null true
Logic: One condition must be true (OR)

RECORD UPDATE: myRule_1_A1
Find all pba__Listing__c records where:
AssessmentsYN__c Equals 1
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AssessmentsYN__c = Yes
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_1_A2
Find all pba__Listing__c records where:
AssessmentsYN__c Equals 0
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AssessmentsYN__c = No
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

DECISION: myDecision2
Executed this outcome: myRule_3
Outcome conditions: and
1. {!formula_myRule_3} (true) Equals true
Logic: All conditions must be true (AND)

DECISION: myRule_3_pmetdec
Executed this outcome: myRule_3_pmetnullrule
Outcome conditions: or
1. {!myVariable_old} (null) Is null true
Logic: One condition must be true (OR)

RECORD UPDATE: myRule_3_A1
Find all pba__Listing__c records where:
AuctionYN__c Equals 1
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AuctionYN__c = Yes
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_3_A2
Find all pba__Listing__c records where:
AuctionYN__c Equals 0
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AuctionYN__c = No
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

I had a few questions regarding how the process builder operates I was hoping one of you could help me understand

1) Is there a difference between the criteria for the action group and the criteria for the immediate action? Since the flow evaluates all the actions regardless, I'm not sure if this makes much of a difference. 
2) Does flow recursion significantly increase the CPU time?
3) I was also thinking of making parallel PB flows to make the workflow look more organized on the back end. Is that okay or would it just cause more problems for me in the long run?

Thanks for reading. I might be missing a few pieces due to a lack of coding knowledge so any insight would be greatly appreciated!