• Chetan Kapania
  • NEWBIE
  • 60 Points
  • Member since 2017
  • Consultant
  • Personal

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 59
    Replies
Custom picklist field Called Status__C in Case object.

Requirment:
Once user select Status__C field value as Rejected need custom field called Rejected__Reason__C should auto populate next to Status__C  to enter rejected reason.

How to achieve this??

can we have any out of box functionality ??

need any code development ??

Thanks in advance
public class MetadataExample {
    
    public void updateMetadata() {
        Metadata.CustomMetadata customMetaData = new Metadata.CustomMetadata();
        customMetaData.fullName = 'MyNamespace__MyMetadataTypeName.MyMetadataRecordName';
        
        Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
         customField.field = 'customField__c';
        customField.value = 'New value';
        
        customMetadata.values.add(customField);
        Metadata.DeployContainer deployContainer = new Metadata.DeployContainer();
        deployContainer.addMetadata(customMetadata);
        
        Id asyncResultId = Metadata.Operations.enqueueDeployment(deployContainer,null);
    }
}

Courtsey: https://www.youtube.com/watch?v=4U2M75X5M8Q
I have created a hotel reservation app, under which I am trying to control values of picklist field Status in Room object through another field Check in Date in other object Reservation. Both object have lookup relationship between them. For e.g. if Check in Date field is empty, Status field should show Vacant else it should update as Booked/Occupied.
Getting error message while trying to complete Trailhead challenge

Action failed: c:AccountMap$controller$accountsLoaded [Cannot read property 'length' of undefined]
Callback failed: apex://AccountController/ACTION$findAll
Failing descriptor: {c:AccountMap$controller$accountsLoaded}

Also when trying to save the challenge error message:
The AccountMap component does not handle the 'AccountSelected' event.

Need Assistance
While I am trying to complete Trailhead module for platform events, this is the error message which I am getting.
User-added image

This is the code which I have written as of now,
User-added image
Kindly advise if any changes are required.

Regards
Chetan
public class MetadataExample {
    
    public void updateMetadata() {
        Metadata.CustomMetadata customMetaData = new Metadata.CustomMetadata();
        customMetaData.fullName = 'MyNamespace__MyMetadataTypeName.MyMetadataRecordName';
        
        Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
         customField.field = 'customField__c';
        customField.value = 'New value';
        
        customMetadata.values.add(customField);
        Metadata.DeployContainer deployContainer = new Metadata.DeployContainer();
        deployContainer.addMetadata(customMetadata);
        
        Id asyncResultId = Metadata.Operations.enqueueDeployment(deployContainer,null);
    }
}

Courtsey: https://www.youtube.com/watch?v=4U2M75X5M8Q
public class MetadataExample {
    
    public void updateMetadata() {
        Metadata.CustomMetadata customMetaData = new Metadata.CustomMetadata();
        customMetaData.fullName = 'MyNamespace__MyMetadataTypeName.MyMetadataRecordName';
        
        Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
         customField.field = 'customField__c';
        customField.value = 'New value';
        
        customMetadata.values.add(customField);
        Metadata.DeployContainer deployContainer = new Metadata.DeployContainer();
        deployContainer.addMetadata(customMetadata);
        
        Id asyncResultId = Metadata.Operations.enqueueDeployment(deployContainer,null);
    }
}

Courtsey: https://www.youtube.com/watch?v=4U2M75X5M8Q
Getting error message while trying to complete Trailhead challenge

Action failed: c:AccountMap$controller$accountsLoaded [Cannot read property 'length' of undefined]
Callback failed: apex://AccountController/ACTION$findAll
Failing descriptor: {c:AccountMap$controller$accountsLoaded}

Also when trying to save the challenge error message:
The AccountMap component does not handle the 'AccountSelected' event.

Need Assistance
Create a Queueable Apex class that inserts the same Contact for each Account for a specific state. Write unit tests that achieve 100% code coverage for the class.
Create an Apex class called 'AddPrimaryContact' that implements the Queueable interface.
Create a constructor for the class that accepts as its first argument a Contact sObject and a second argument as a string for the State abbreviation.
The execute method must query for a maximum of 200 Accounts with the BillingState specified by the State abbreviation passed into the constructor and insert the Contact sObject record associated to each Account. Look at the sObject clone() method.
Create an Apex test class called 'AddPrimaryContactTest'.
In the test class, insert 50 Account records for BillingState "NY" and 50 Account records for BillingState "CA". Create an instance of the AddPrimaryContact class, enqueue the job and assert that a Contact record was inserted for each of the 50 Accounts with the BillingState of "CA".
The unit tests must cover all lines of code included in the AddPrimaryContact class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.
I am not able to get through this challenge. 
I logged in through SOAPUI and used the session id to create an account. The account gets created and returns success. However when I try to validate the challenge in trailhead, it gives me an error - 

Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you have logged in using SoapUI.

I am not sure what did I miss out.
Hi all,

I am having an issue/error with above trailhead badge 3rd unit and the error is as shown below.  Even after verification of the quick actions applied to the selected list, the same error pops up.

Challenge Not yet complete... here's what's wrong:
One or more of the quick actions were not added to 'Field Sales App'


Thanks in advance.

With regards,
Kalesha Vali
Hi guys, the quote template has lots of limitations when it comes to styling; I would like to do something custom and need a step-by-step guide. Basically, I would like a "create quote" button on quote pagelayout that references my visualforce page and creates the pdf. 

So I think I need to follow the steps below:
1. Create a custom controller class. Can I do this with standard List controller? Basically, I have to query all the quote and quotelineitems
2. Create a new visual force page using controller from step1, add the proper styling and render as pdf.
3. Create the button on quote with a link to visual force page
Any tips and guides are appreciated. 
Thanks.

Did I miss anything? 
 
  • October 17, 2016
  • Like
  • 0
Challenge - Create a form to enter new items and display the list of items entered. To make our camping list look more appealing, change the campingHeader component to use the SLDS. Similar to the unit, style the Camping List H1 inside the slds-page-header. Modify the campingList component to contain an input form and an iteration of campingListItem components for displaying the items entered.
The component requires an attribute named items with the type of an array of camping item custom objects.
The component requires an attribute named newItem of type Camping_Item__c with default quantity and price values of 0.
The component displays the Name, Quantity, Price, and Packed form fields with the appropriate input component types and values from the newItem attribute.
The JavaScript controller checks to ensure that the Name, Quantity and Price values submitted are not null.
If the form is valid, the JavaScript controller pushes the newItem onto the array of existing items, triggers the notification that the items value provider has changed, and resets the newItem value provider with a blank sObjectType of Camping_Item__c.


My answer - 
<aura:component >
<aura:attribute name="items" type="Camping_Item__c[]"/>
<aura:attribute name="newitem" type="Camping_Item__c[]"  default="{ 'sobjectType': 'Camping_Item__c',
                   'Quantity__c'=0, 'Price__c'=0}"/>
 <p>Name:
        <ui:inputText value="{!v.newitem.name}"/>
    </p>    
  <p>Packed:
        <ui:inputCheckbox value="{!v.newitem.Packed__c}"/>
     
    </p>    
  <p>Price:
        <ui:inputCurrency value="{!v.newitem.Price__c}"/>
    </p>
    <p>Quantity:
        <ui:inputNumber value="{!v.newitem.Quantity__c}"/>
    </p>
</aura:component>


Error -

Challenge Not yet complete... here's what's wrong: 
The campingList component isn't iterating the array of 'items' and creating 'campingListItem' components.

Please share the correct solution.
Here is the Question


Create an Apex class that implements the Schedulable interface to update Lead records with a specific LeadSource. Write unit tests that achieve 100% code coverage for the class. This is very similar to what you did for Batch Apex.
Create an Apex class called 'DailyLeadProcessor' that uses the Schedulable interface.
The execute method must find the first 200 Leads with a blank LeadSource field and update them with the LeadSource value of 'Dreamforce'.
Create an Apex test class called 'DailyLeadProcessorTest'.
In the test class, insert 200 Lead records, schedule the DailyLeadProcessor class to run and test that all Lead records were updated correctly.
The unit tests must cover all lines of code included in the DailyLeadProcessor class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.


Here is my code so far

global class DailyLeadProcessor implements Schedulable {

    global void execute(SchedulableContext ctx) {
        list<leads>Lead = [select leadSource from lead where isnull= true]
        
         for (Integer i = 0; i < 200; i++) {
            Leads.add(new lead(
                name='Dream force'+i
            ));
        }
        insert Leads;
    }

I am not sure what is wrong here
Why would the Switch perspective and view log panels be greyed out.  I added all of the permissions I thought I would need.  Is there something I am missing?