• pankaj singla 39
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
Hi All,

I have created a form handler in Pardot which captures the data from HTML form and creates a prospects in Pardot. Further, I need to set the cookie on a client and when the user visit the form, it checks if the cookie is already present, it reads the data from the cookie and pre-populates the HTML form.
Let me know any inputs on this. #Pardot #Marketing Cloud
 
Hi,
I am facing issue with Step 6. I am able to pass the chalenge but the functionality is not working. The error is I am not able to get the Id of the selected boat in the BoatTileController. PFB my Code
#Parent Component- BoatSearchResults.cmp
<aura:component controller="BoatSearchResults">
    <aura:method name="search" action="{!c.search}" 
                        description="Sample method with parameters" access="public"> 
       <aura:attribute name="param1" type="String"/> 
    </aura:method>
    <aura:attribute name="boats" type="Boat__c[]" />
    <aura:attribute name="boatTypeId" type="string" default="" />
    <aura:attribute name="selectedBoatId" type="Id" default="" />
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:handler name="BoatSelect" event="c:BoatSelect" action="{!c.onBoatSelect}"/>
    <lightning:layout multipleRows="true" horizontalAlign="center">

    	    <aura:iteration items="{!v.boats}" var="boatVar">
                <lightning:layoutItem flexibility="grow"  class="slds-m-right_small" >   
                	<c:BoatTile boat="{!boatVar}" selected="{!boatVar.Id == v.selectedBoatId ? 'true' : 'false' }"/>
                </lightning:layoutItem>
            </aura:iteration>
    		
               
            <aura:if isTrue="{!v.boats.length==0}">
                <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
                    <ui:outputText value="No boats found" />
                </lightning:layoutItem>
            </aura:if>

    </lightning:layout>
</aura:component>

#Child Component: BoatTile.cmp
<aura:component >

    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="selected" type="boolean" default="false"/>
    <aura:registerEvent name="BoatSelect" type="c:BoatSelect"/>
    <aura:attribute name="selectedBoatId" type="Id"/>

        <lightning:button label="Packed!" onclick="{!c.onBoatClick}"
                          class="{! v.selected ? 'tile selected' : 'tile' }">
            <div style="{!'background-image:url(\'' + v.boat.Picture__c + '\')'}"
                 class="innertile">
                <div class="lower-third">
                    <h1 class="slds-truncate">{! v.boat.Contact__r.Name}</h1>
                </div>
            </div>
        </lightning:button>

</aura:component>

Controller: BoatTileController
 
({
    onBoatClick : function(component, event, helper) {
        var cmpEvent = component.getEvent("BoatSelect");
        //var boatId = component.get("v.boat.Id");
        var bb=component.get("v.boat");
        console.log('var bb is-'+bb.id);
        var boatId = event.getSource().get("v.label");
        console.log('boatId-'+boatId);
        cmpEvent.setParams({
            "boatId" : boatId
        });
        cmpEvent.fire();
    }
})

I need to get the attribute boat in the BoatTileController but it shows the value as Undefined. Please help me resolve the issue.
 
Hi,
I am facing issue with Step 6. I am able to pass the chalenge but the functionality is not working. The error is I am not able to get the Id of the selected boat in the BoatTileController. PFB my Code
#Parent Component- BoatSearchResults.cmp
<aura:component controller="BoatSearchResults">
    <aura:method name="search" action="{!c.search}" 
                        description="Sample method with parameters" access="public"> 
       <aura:attribute name="param1" type="String"/> 
    </aura:method>
    <aura:attribute name="boats" type="Boat__c[]" />
    <aura:attribute name="boatTypeId" type="string" default="" />
    <aura:attribute name="selectedBoatId" type="Id" default="" />
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:handler name="BoatSelect" event="c:BoatSelect" action="{!c.onBoatSelect}"/>
    <lightning:layout multipleRows="true" horizontalAlign="center">

    	    <aura:iteration items="{!v.boats}" var="boatVar">
                <lightning:layoutItem flexibility="grow"  class="slds-m-right_small" >   
                	<c:BoatTile boat="{!boatVar}" selected="{!boatVar.Id == v.selectedBoatId ? 'true' : 'false' }"/>
                </lightning:layoutItem>
            </aura:iteration>
    		
               
            <aura:if isTrue="{!v.boats.length==0}">
                <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
                    <ui:outputText value="No boats found" />
                </lightning:layoutItem>
            </aura:if>

    </lightning:layout>
</aura:component>

#Child Component: BoatTile.cmp
<aura:component >

    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="selected" type="boolean" default="false"/>
    <aura:registerEvent name="BoatSelect" type="c:BoatSelect"/>
    <aura:attribute name="selectedBoatId" type="Id"/>

        <lightning:button label="Packed!" onclick="{!c.onBoatClick}"
                          class="{! v.selected ? 'tile selected' : 'tile' }">
            <div style="{!'background-image:url(\'' + v.boat.Picture__c + '\')'}"
                 class="innertile">
                <div class="lower-third">
                    <h1 class="slds-truncate">{! v.boat.Contact__r.Name}</h1>
                </div>
            </div>
        </lightning:button>

</aura:component>

Controller: BoatTileController
 
({
    onBoatClick : function(component, event, helper) {
        var cmpEvent = component.getEvent("BoatSelect");
        //var boatId = component.get("v.boat.Id");
        var bb=component.get("v.boat");
        console.log('var bb is-'+bb.id);
        var boatId = event.getSource().get("v.label");
        console.log('boatId-'+boatId);
        cmpEvent.setParams({
            "boatId" : boatId
        });
        cmpEvent.fire();
    }
})

I need to get the attribute boat in the BoatTileController but it shows the value as Undefined. Please help me resolve the issue.
 
I'm using Trailhead to learn something about Lightning, since we are refactoring form Classic.
The tutorial had me created a new App using the Setup > Home > App Manager > New Lightning App path.
I created my app, but when I attempt to access it, I cannot see it in the App Launcher view. 
I can see it in the App Manager, so I know it's there. 
------------------------
The directions are:
From the Home tab in Setup, enter App in the Quick Find box, then select App Manager.
Click New Lightning App.
In the Lightning App Wizard, create an app with these parameters.
App nameDelivery Tracker
DescriptionTrack warehouse deliveries.
ImageYour choice!
Use a JPG, PNG, BMP, or GIF image that’s smaller than 5 MB. For best results, upload an image that’s 128 by 128 pixels. Images larger than the maximum display of 128 by 128 pixels are automatically resized.
Primary hex color value#09D4EA
App navigationStandard
Navigation bar items (in this order)Warehouses, Deliveries, Merchandise, Accounts, Contacts, Cases, Reports
Assigned to user profileSystem Administrator
Click Save and Finish to exit the wizard.
Click  to open the App Launcher, and select the Delivery Tracker app.
Check out the new app!
It’s got all the custom branding we gave it: a custom icon in the upper left and the custom color we assigned to it. Because Warehouses is first in the navigation bar, it becomes the landing page for the app. And even though App Launcher was an item available for the navigation bar, we didn’t have to add it. It’s there, accessible by clicking .
Hi, 
I have created the following components for this step:

BoatSearchForm.cmp
<aura:component controller="BoatSearchForm" implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="searchOptions" type='String[]' default='All'/>
    <aura:attribute name='searchOptionToIdMap' type='Map' default="{All:''}" />
    <aura:attribute name='showNewButton' type='Boolean' default='false'/>

    <lightning:layout horizontalAlign="center"   >

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 

           <lightning:select aura:id='typeSelect' name='selectItem' onchange=''>
             <aura:iteration items='{!v.searchOptions}' var='option'>
                 <option value='{!option}' text='{!option}'></option>
             </aura:iteration>
         </lightning:select>
       </lightning:layoutItem>

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 
         <lightning:button label="Search" variant="brand"  />
         <aura:if isTrue='{!v.showNewButton}'>
            <lightning:button variant='neutral' label='New' onclick='{!c.createBoat}'/>
        </aura:if>
       </lightning:layoutItem>

    </lightning:layout>

</aura:component>

BoatSearchController.js
({
     doInit: function(component) 
    {
       console.log('inside do init '); 
        debugger;
       var action=component.get('c.getSearchOptions');
        action.setcallback(this,function(response)
         {
             debugger;
             var state = response.getState();
             if (state === "SUCCESS")
             {
                 debugger;
                 console.log('inside success state');
                 component.set('v.searchOptionToIdMap',response.getReturnValue());
                 var custs = [];
                 var conts = response.getReturnValue();
                 for(var key in conts)
                 {
                    console.log('populated list');
                     custs.push({value:conts[key], key:key});
                 }
                 component.set("v.searchOptions", custs);
             }
             
         }); 
    }, 
     createBoat: function (component) 
     {
            console.log('inside controller');
            var createRecordEvent = $A.get('e.force:createRecord');
            if (createRecordEvent) 
            {
                    var typeName = component.find('typeSelect').get('v.value');
                    var typeMap = component.get('v.searchOptionToIdMap');
                    var typeId = null;
                    if (typeName && typeMap && typeMap[typeName]) 
                    {
                            typeId = typeMap[typeName];
                    }
                    createRecordEvent.setParams({
                        'entityApiName': 'Boat__c',
                        'defaultFieldValues': {
                            'BoatType__c': typeId
                        }
                    });
                    createRecordEvent.fire();
            }
       }
})
BoatSearchHelper.js
({
    renderNewButton: function (component) {
    var createRecordEvent = $A.get('e.force:createRecord');
    if (createRecordEvent) {
        component.set('v.showNewButton', true);
    }
}})

Apex Controller:
public with sharing class BoatSearchForm
{
        @AuraEnabled
        public static Map<String, String> getSearchOptions() 
        {
                List<BoatType__c> boatTypes = [SELECT Id, Name FROM BoatType__c LIMIT 400];
                Map<String, String> returnMap = new Map<String, String>();
                if(!boatTypes.isEmpty())
                {
                        for(BoatType__c bt: boatTypes)
                        {
                            returnMap.put(bt.Name, bt.Id);
                        }
                }
                return returnMap;
        }
}
FriendswithBoat.app
<aura:application extends="force:slds">
    <lightning:layout >
                 
                 <lightning:card title="Find a Boat" class="slds-m-top_10px" >
                          <c:BoatSearchForm />
                 </lightning:card>

    </lightning:layout>
</aura:application>

Whenever I try to load my app I get this error:
User-added image

Something is wrong with my component. I am not able to identify it. Can anyone help me with this?
I've been looking at the destructivechanges.xml file section of the Force Migration Tool and was wondering if anyone has been able to remove list views (views within Leads, Accounts, etc) but not removing the core object (Lead, Account, etc).

In our example, we want to clean up some of the default views within the Leads and Accounts tabs.   What I cannot figure out is how to specify only those items, since the package.xml doesn't really go deeper than listing the Lead and Account object (as shown below):

    <types>
        <members>Account</members>
        <members>Lead</members>
        <name>CustomObject</name>
    </types>

I would guess that putting the information in the destructivechanges.xml would remove the Account and Lead objects ... or at least attempt to. :) Instead, I would prefer to remove <listViews> items from the Account.object and Lead.object files.  Example below:

    <listViews>
        <fullName>AccountsInMyMarket</fullName>
        <booleanFilter>1</booleanFilter>
        <columns>ACCOUNT.NAME</columns>
        <columns>ACCOUNT.ADDRESS1_STATE</columns>
        <columns>ACCOUNT.PHONE1</columns>
        <columns>ACCOUNT.TYPE</columns>
        <columns>CORE.USERS.ALIAS</columns>
        <filterScope>Everything</filterScope>
        <filters>
            <field>Is_My_Market__c</field>
            <operation>equals</operation>
            <value>1</value>
        </filters>
        <label>Accounts In My Market</label>
    </listViews>

I would like to remove the Accounts In My Market item as shown above.

Any idea how to do that using the Force Migration Tool and destructivechanges.xml?

Thanks so much for your time!
jv
 

Hi all,

 

I've written a trigger that creates new campaignmemberstatus' on campaign insert based on some custom settings. The test code is causing me some difficulties. I've narrowed it down to the fact that my query of current CampaignMemberStatus' never returns any results (despite working just fine in the sandbox). Any help would be appreciated!

 

Trigger code:

/**** GET APPROPRIATE STATUSES FROM CAMPAIGN SETTINGS OBJECT ****/	
	
	Map <Id, Map<Integer,List<String>>> statusmap = new Map<Id, Map<Integer, List<String>>>(); //map of record type Ids to campaign status ordered list (sort order to label,hasresponded)
	
	Schema.DescribeSObjectResult describe = Schema.SObjectType.Campaign;
	List<RecordTypeInfo> typeslist = describe.getRecordTypeInfos(); //list of all record types for Campaign
	
	Map <String, CampaignSetting__c> allsettings = CampaignSetting__c.getAll(); //map of all custom campaign settings, string = record type name

	for (RecordTypeInfo recordtype : typeslist) {
		String tempname = recordtype.getName();
		try { //only works if settings exist for this record type
			list<String> statuslist = allsettings.get(tempname).StatusList__c.split('::',0);
			list<String> respondedlist = allsettings.get(tempname).StatusResponded__c.split('::',0);
			integer loopcount = 0;						
			Map <Integer, List<String>> innermap = new Map<Integer, List<String>>();
			for (String status : statuslist) {
				innermap.put(loopcount, new String[]{statuslist[loopcount],respondedlist[loopcount]});
				loopcount++;
			}
			statusmap.put(recordtype.getRecordTypeId(),innermap);	
		}	
		catch (Exception e) {
			//fail silently if no custom settings for this record type exist
		}		
	}
	
	system.debug('statusmap: '+statusmap);

/**** CAMPAIGNS IN TRIGGER ****/


	List<CampaignMemberStatus> dummylist = new List<CampaignMemberStatus>();
	List<CampaignMemberStatus> deletelist = new List<CampaignMemberStatus>();
	List<CampaignMemberStatus> insertlist = new List<CampaignMemberStatus>();
	system.debug('newMap '+Trigger.newMap);
	List<CampaignMemberStatus> queryresults = [Select Id, CampaignId, IsDefault from CampaignMemberStatus WHERE CampaignId in :Trigger.newMap.keySet()];
	system.debug('queryresults: '+queryresults);
	for (CampaignMemberStatus status : queryresults) {
		if (statusmap.containsKey(Trigger.newMap.get(status.CampaignId).RecordTypeId)) { //delete statuses from campaigns that will get new member status'
			deletelist.add(status);
		}
	}
	system.debug('deletelist: '+deletelist);
	for (Campaign camp : Trigger.newMap.values()) {
		if (statusmap.containsKey(camp.RecordTypeId)) { //if there are settings for this campaign's record type	
			integer ordercount = 0;					
			for (Integer statusorder : statusmap.get(camp.RecordTypeId).keySet()) { //for each status in the setting
				List<String> valueslist = statusmap.get(camp.RecordTypeId).get(statusorder); //get the values as list. order is 0 = label, 1 = hasresponded
				CampaignMemberStatus newmemb = new CampaignMemberStatus(CampaignId=camp.Id,SortOrder=statusorder, Label=valueslist[0], HasResponded=Boolean.valueOf(valueslist[1]));
				if (statusorder == 0) {
					newmemb.IsDefault = true;
				}
				insertlist.add(newmemb);
				ordercount++;
			}
			dummylist.add(new CampaignMemberStatus(CampaignID = camp.Id, SortOrder=ordercount, Label='Dummy',IsDefault= true));		//set as default so all old values can be deleted
			system.debug('dummylist: '+dummylist);
		}		
	}
	system.debug('insertlist: '+insertlist);
	insert dummylist;	
	delete deletelist;
	insert insertlist;
	for (CampaignMemberStatus status : dummylist) {
		status.IsDefault = false; //take away default status so dummy values can be deleted
	}
	delete dummylist;			
	
}

 

Test Code (mainly to test a VF page that inserts a new campaign of a specific record type):

I'm not getting very far because the controller.generateMeeting() method inserts the campaign, and that is where it fails.

    static testMethod void Schedulingtest() {
    	//set up committee to schedule
        Committee__c committee = new Committee__c(Name='Test');
        insert committee;
        Contact con1 = createContact();
        Contact con2 = createContact();
        Contact con3 = createContact();
        insert con1;
        insert con2;
        insert con3;
        Term__c term1 = new Term__c(Name='test',Member__c=con1.Id,Committee__c=committee.Id, Stage__c='Elected', End_Date__c=date.today().adddays(30));
        Term__c term2 = new Term__c(Name='test',Member__c=con2.Id,Committee__c=committee.Id, Stage__c='Elected', Start_Date__c=date.today().adddays(30));
        Term__c term3 = new Term__c(Name='test',Member__c=con3.Id,Committee__c=committee.Id, Stage__c='Elected', End_Date__c=date.today().adddays(-30));
        insert term1;
        insert term2;
        insert term3;
        
        CampaignSetting__c setting = new CampaignSetting__c(Name='Meeting', RecordTypeID__c='012K00000008oehIAA',StatusList__c='On List::Invited::RSVP Yes::Attended::Declined::No Show',StatusResponded__c='false::false::true::true::false::false');
        insert setting;
        
        //instantiate scheduler controller
        ApexPages.currentPage().getParameters().put('id', committee.Id);
        ApexPages.StandardController StdController = new ApexPages.StandardController(committee);
        ScheduleMeetingController controller = new ScheduleMeetingController(StdController);
        
        //create name, then run scheduler with defaults (invite current members only)
        controller.themeeting.Name='Active only meeting';
        controller.generateMeeting();
        Campaign Meeting1 = [Select Id, NumberofContacts from Campaign where Id = :controller.themeeting.id];
        system.assertequals(1,Meeting1.NumberofContacts); //verify that 1 invitation/campaign membership was added and the meeting created