• Shruti Mathur 59
  • NEWBIE
  • 25 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Visualforce Page not accessible via Community.
1. Created a lightning button on clivk of which the vf page needs to be rendered as a pdf.
2. Given access to Community User profile and Site guest profile both

Still the problem persists

I am working on writing a custom Lightning component for use in a Community. What I need it to do is basically recreate the "Articles with this Topic" default component that goes on the Topic Detail page. The default component doesn't allow for custom sorting or custom messaging based on criteria such as the number of articles in the list or if the Topic is linked to another object record, so I am writing my own that will allow for these things.

I am getting stuck on querying the TopicAssignment object in the Apex controller, which I think must be a permissions issue. When I view the component as myself (System Administrator profile) it appears to work, and I get the list of Knowledge articles. When I log in as a Community User (Customer Community User profile), the Apex method returns an empty list. The code for that Apex method is listed below:

public static List<Knowledge__kav> getArticlesForTopic(String topicId)
	{
		try
		{ 
			return [SELECT Id, Title, Subtitle__c, Article_Body__c FROM Knowledge__kav WHERE Id IN (SELECT EntityId FROM TopicAssignment WHERE TopicId = :topicId) AND PublishStatus = 'Online' ORDER BY Sequence__c ASC, LastPublishedDate DESC]; 
		}
		catch(QueryException qe)
		{
			return null;
		}
		catch(Exception e)
		{
			System.debug(JRBRepo.handleError(e,TRUE));
			return null;
		}
	}
I cannot find the Topic or TopicAssignment objects through the Object Manager UI, so I cannot see a way to grant permissions to these objects for the Community User profile. I see under the System Permissions section that there are several permissions related to managing Topics, but not one for just reading Topics. I don't want the Community Users to have control over Topics or the assignment of Topics, I just need them to be able to read them.

Is there a permission that I am missing, or are those objects named something different in the Object Manager UI? 
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.



 
public class VerifyDate {
//method to handle potential checks against two dates
public static Date CheckDates(Date date1, Date date2) {
//if date2 is within the next 30 days of date1, use date2. Otherwise use the end of the month
if(DateWithin30Days(date1,date2)) {
return date2;
} else {
return SetEndOfMonthDate(date1);
}
}
//method to check if date2 is within the next 30 days of date1
private static Boolean DateWithin30Days(Date date1, Date date2) {
//check for date2 being in the past
if( date2 < date1) { return false; }
//check that date2 is within (>=) 30 days of date1
Date date30Days = date1.addDays(30); //create a date 30 days away from date1
if( date2 >= date30Days ) { return false; }
else { return true; }
}
//method to return the end of the month of a given date
private static Date SetEndOfMonthDate(Date date1) {
Integer totalDays = Date.daysInMonth(date1.year(), date1.month());
Date lastDay = Date.newInstance(date1.year(), date1.month(), totalDays);
return lastDay;
}
}

I need test class for this class.Please provide me