• Mikhail Rzhevsky
  • NEWBIE
  • 4 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies

Hello.

I have lightning component, working on community page and need to get reference to the main salesforce site for get link to download content form ContentVersion. Link must be like this

var documentId = "https://study-####--####.lightning.force.com/sfc/servlet.shepherd/document/download/";

I tried a lot of variants from URL class like getHost(), getPath(), getRef(), getSalesforceBaseUrl(), getCurrentRequestUrl().

But I can only get component's url  from controller of community it is like this

https://conf-######.##70.force.com
If you have any ideas,please share it.


 

HI ,I am doing a trailhead on salesforce Lighting this is my code 

<aura:component >
    <aura:attribute name="item"  type="Camping_Item__c"  /> <!-- required="true" type="String"  -->
    <p> The Item is <ui:outputText value ="{!v.item}"></ui:outputText></p>
    <p>Name:
        <ui:outputText value="{!v.item.name}" /> 
    </p>

    <p>Quantity:
        <ui:outputNumber value="{!v.item.Quantity__c}" /> 
    </p>

    <p>Price:
        <ui:outputCurrency value="{!v.item.Price__c}" /> 
    </p>

    <p>Packed?:
        <ui:outputCheckbox value="{!v.item.Packed__c}" /> 
    </p>
    
    <p><ui:button label="Packed!" press="{!c.packItem}"></ui:button>
    </p>
</aura:component>



Now Its required of me to :
Add a button to the campingListItem component that when clicked, marks the item as packed.
1.Add a button labeled "Packed!" that calls the packItem controller function when clicked.
2.The controller action marks the item attribute as packed and disables the button.

I have done with the first point
I'm struggling with the second point.

the controller code looks something like this (which currently isnt working)

({
    packItem : function(component, event, helper) {
        var btn= event.getSource();
        var BtnMessage =btn.get("v.label");  
        component.set("v.item","Packed");          
        btn.disabled=false;
    }
})



each time I have failing the trailhead because of this error message
Challenge Not yet complete... here's what's wrong: 
The campingListItem JavaScript controller isn't setting the 'Packed' value correctly.



 
Trying to complete this Challenge, but keep getting the following error despite many variations on trying to load the file.  I think I've also completed the rest of the challenge, but am unable to even check since I can't seem to get past this first "easy" part.  Thoughts?
 


  • {!c.Name}

Here are the directions:

Use Bootstrap to create a simple mobile friendly list of existing contact names and display the page within Salesforce1 mobile. The Visualforce page:Must be named 'MobileContactList'.
Must reference the minified Bootstrap JavaScript and CSS files from MaxCDN (see more here). Do NOT use Static Resources to reference these files.
Must use the Bootstrap List Group component (defined here).
Must use the Contact standard list controller with a recordSetVar of 'contacts'. The list of contacts must be iterated through using an apex:repeat component that's bound to a var named 'c'.
Must display the name of the contacts.
Must be made available for the Salesforce1 mobile app and added to a tab named 'MobileContacts'. The tab should be added to the Salesforce1 navigation menu.
Hi,
I am not able to understand the below question correctly Please help me out. - 
Create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code (API name: MailingPostalCode) matching the second. It gets the ID and Name of those contacts and returns them.The Apex class must be called 'ContactSearch' and be in the public scope.
The Apex class must have a public static method called 'searchForContacts'.
The 'searchForContacts' method must accept two incoming strings as parameters, find any contact that has a last name matching the first, and mailing postal code matching the second string. The method should return a list of Contact records with at least the ID and Name fields.
The return type for 'searchForContacts' must be 'List<Contact>'.
HI,

How to Display the Reports and Dashboards in Partner Community .Which permissions need to give if we want to access the reports and dashboards in Community ?


please advise .


Thanks,
Shiva
Hello developer heroes!

I'm working through the Apex modules on Trailhead and can't seem to get past this one: https://developer.salesforce.com/en/trailhead/force_com_programmatic_beginner/apex_triggers/apex_triggers_bulk.

Hopefully this doesn't read like a 'please complete the course for me' kinda post, but I have written a trigger that I believe meets the criteria but it isn't passing the check, so I wanted to seek the guidance of the experts.

The challenge is to do this:

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.


And here is the trigger I have come up with, which compiles OK and stands up to a manual (though admittedly unbulkified) test:
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {

    List<Task> taskList = new List<Task>();
    
    for (Opportunity opp : [SELECT Id, StageName FROM Opportunity WHERE StageName = 'Closed Won' AND Id IN :Trigger.new]){
                    
            taskList.add(new Task(Subject = 'Follow Up Test Task',
                                  WhatId = opp.Id));
       
    }

    if(taskList.size()>0){
        
        insert taskList;
        
    }
    
}
I have tried replacing the SOQL with a straightforward 'for (Opportunity opp : Trigger.new)' and having the taskList.add inside an IF that checks for Closed Won - no luck. I also thought about checking to see if the stage was being changed to Closed Won, rather than the trigger firing on every edit, but I don't think this is what the module is asking for.

Where do you think I'm going wrong?

Huge thanks in advance!