• Pasan Eeriyagama
  • NEWBIE
  • 105 Points
  • Member since 2016
  • Technical Consultant


  • Chatter
    Feed
  • 2
    Best Answers
  • 2
    Likes Received
  • 2
    Likes Given
  • 19
    Questions
  • 44
    Replies
Hi,
I am stuck on the Atttributes and Expressions challenge of the lightening component basics:

I get the following message: The Name field is not being displayed using an expression.

I'm really not 100% sure how the display component is meant to work for Name and Packed status - as there seems to be no "<lightening: /> formatting markup available. 

Here is my code:

<aura:component>

    <aura:attribute name="item" type="Camping_Item__c" required="true" />

    <aura:attribute name="expense" type="Expense__c"/>
    
    <p>Name: 
        <lightning:String value="{!v.item.Name__c}" style="Text"/>
    </p>
    
    <p>Price:
        <lightning:formattedNumber value="{!v.item.Price__c}" style="Currency"/>
    </p>
    
    <p>Quantity:
        <lightning:formattedNumber value="{!v.item.Quantity__c}" style="Number"/>
    </p>
    
    <p>Packed Status:
        <lightning:Checkbox value="{!v.item.Packed__c}" style="Toggle"/>
    </p>

</aura:component>

Thanks for your assistance in advance.
Hi,

I have a word document containing a numbered bullet point list. I need to display the text on a Visualforce page in the same style but can't figure out how to get the list styles to work. Could someone help me out?

0down votefavorite
In our managed package we have 'XYZ' namespace in most of our product sourcecode.
When we try to get this to DX, as per Salesforce guide here we must create an unmanaged package.
Salesforce doesn't allow creating an unmanaged package with sourcecode which has references to a namespace and throws below Error.

Unmanaged packages cannot explicitly reference this organization's namespace.

I think this is fair because we cannot ship an unmanaged package with a namespace.

But we noticed custom objects can be packaged as unmanaged with namespace, and even after we moved to DX, they still shows up in DX orgs with namespace.
Is there a way that we can transport our sourcecode with managed package references to DX? Appreciate any help, Thanks.
Found this issue in Internet Explorer. Below is my code.

testApp.app​
<aura:application >
    <aura:attribute name="opp" type="Opportunity" default="{ 'sobjectType': 'Opportunity', 'Name':''}" access="public"/>
    <ui:inputText value="{!v.opp.Name}" keyup="{!c.readName}"/>
</aura:application>
JS Controller
 
({
    readName: function(component, event, helper) {

        if ((event.getParams().keyCode) != 13)
            return;

        var opp = component.get('v.opp');

        console.log('item: '+JSON.stringify(opp));
    },
})

In Internet Explorer
console.log() logs nothing for opp.Name
User-added image

In Firefox (Other browsers also works fine)


User-added image

I tried using a String type,also using keydown event, but doesn't seem to work for even simple String variables.Is this a bug in SF?
Appreciate any help on this?
Thanks.
 
We have below simple example visualforce page (to be used as inline VF page for Opportunity).
 
<apex:page standardController="Opportunity" >
    This page doesn't have any content.
</apex:page>

This page is added to Opportunity page layout for Partner Community User.
When we view as partner community user, it appears as a link as below.

User-added image

Because of this, it seems contents inline pages are not accessible. Also when we click on this page, it goes to 'Invalid page' community page which is not intended at all.
Any idea how we can remove this link behavior? Appreciate any help on this. Thanks.
 
We're having below markup in Lightning component.
<lightning:icon aura:id="statusIcon" iconName="action:check" size="xx-small"/>

When java-script is controller prints the page with this component, seems like it's omitting this icon.
 
window.print();


is used to print the page.

Is there a way I can get this icon on printed output? Appreciate any help. Thanks.
I'm trying to share a record for community user. Tried below code in Execute anonymous.
 
// Create new sharing object for the custom object.
myObject__Share objShare  = new myObject__Share();

// Set the ID of record being shared.
objShare.ParentId = 'a0Vf4000001Hprq'; //recordId;

// Set the ID of user or group being granted access.
objShare.UserOrGroupId = '005f4000000vjvX';

// Set the access level.
objShare.AccessLevel = 'Read';

insert objShare;

But unfortunately it fails with error "Line: 14, Column: 1
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: unknown (invalid user or group: 005f4000000vjvX): [unknown]" .

User-added image

Is it not possible to grant sharing access to community users via manual sharing? I could not find a related documention on it. Or should I set some configuration settings for this.
Appreciate any help. Thanks.

Note: This could have been achieved using Sharing sets in Community setttings, but due to design constraint we're not able to use it.


 
I'm trying to print content inside a div as below.
 
printPreview: function(component, event, helper) {
    	//window.print();
        
        
	   var divToPrint=component.find("printableDiv");
	   console.log('divToPrint.outerHTML: '+JSON.stringify(divToPrint.innerHTML));
	   newWin= window.open("");
	   newWin.document.write(divToPrint.outerHTML);
	   newWin.print();
	   newWin.close();
},

But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
I have linked the Trailhead account to Success profile sometime back. But the badge count seem to be different. Success community profile badges count is always several badges behind the Trailhead badges. Not sure why, any idea on this.

Thanks in advance.
Hi,

I'm trying to print preview a lightning component using below.
 
printPreview: function(component, event, helper) {
        var yourDOCTYPE = "<!DOCTYPE html>";
        var printPreview = window.open('about:blank', 'print_preview', "resizable=yes,scrollbars=yes,status=yes");
        var printDocument = printPreview.document;
        printDocument.open();
        printDocument.write(yourDOCTYPE+
                            "<html>"+
                            document.documentElement.innerHTML+
                            "</html>");
        printDocument.close();
        
    },

But it's throwing Lightning exception as below.

User-added image

Any suggestions/workaround to get this working please. Thanks.

 
We have developed Lightning component with Lightning tabset and lightning tabs in it. This component is being used on napili template.
In the documentation it says below.

Usage Considerations
When you load more tabs than can fit the width of the view port, the tabset provides navigation buttons for the overflow tabs.


When this is viewed in computer or on a tab it appears perfect. But when we view it from a mobile screen the it's not hiding the overflowing tabs, providing navigation buttons. Instead it's overflowing the mobile screen making it's hard for community user to view. He needs to scroll right to see the other tabs. This seems like a bug in winter 18. Anyone experiencing this? any workaround? Appreciate any help. Thanks.
Noticed that Lightning tabset is not refreshing on mobile devices.
This can be simulated on browser as well. When it appears on a mobile device initially it appears as,

User-added image

After clicking on different tab it will be refreshed to below.

User-added image

Also on Android chrome/Apple safari this is not refreshing at all. We need to scroll the device screen right to see the tabs.
I believe this worked fine before winter 18. Not sure if there is a refresh() method to refresh the view after initializing. Note this is not a dynamically added tab, it's all in the markup.

Appreciate any suggestions, help on this. 
Thanks.
 
How do you make lightning:inputRichText readonly, there is a disabled attribute. It seems not working yet. Is there a workaround to show it as a readonly field on page (by wrapping with a div tags may be).

markup:
<lightning:inputRichText value="{!v.richTextfield}" disabled="true" disabledCategories="FORMAT_FONT,FORMAT_TEXT,FORMAT_BODY,ALIGN_TEXT,REMOVE_FORMATTING"/>

 
We need to enable wrap text in lightning rich text field.  

Tried below markups including slds-scrollable_y, slds-hyphenate individually and together even in ui:outputRichText class attribute.

Markup:
<div aria-label="" class="slds-rich-text-area__content slds-grow slds-wrap slds-scrollable_y slds-hyphenate">
	<ui:outputRichText value="{!v.richtextFld}"/>
</div>

Am I doing it wrong? Appreciate any suggestions on this. 
We noticed when a user registers for a trial from Appexchange it does not run Insert triggers. Seems it's just creating a snapshot of data instead. Is there any way we could run a Apex or similar post script please? (Without user intervention) Appreciate any clue/tip or advise on this.

We have some sample data records in Trialforce which rely on record Ids, and when new records are created for the new instance by SF, they will have set of new Ids. Therefore making the text values containing Id values Invalid (these string values are generated based on some business logic after insert/update/undelete).
I'm trying to get below lightning component into a own custom component.

User-added image

Seems not exposed to embed, just tried below and no luck.
 
<c:recordDetail recordId="{!v.contactId}"/>

No COMPONENT named markup://c:recordDetail found :

Any help on achieving this, so that it will show up default layout set up for the profile of current user.
We are using Salesforce Napili template community template. Noted that users can see their User record in my profile but not contact fields. Would like to know how to enable updating Contact information for Community users please. Thanks.
I'm trying to read Unit of Measure on Product2. But getting compile time error as below.
 
No such column 'QuantityUnitOfMeasure' on entity 'Product2'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

But in Product entity field seems there.

Product standard fields

Not sure if I am using a wrong field name. In docs I couldn't find this field though. Can someone help me with reading unit of measure in product using SOQL?

Appreciate any help. Thanks.

 
I'm looking for update a Layout input field label (customized) and add the input to Layout under a particular section if it does not exist.

I could write the code for adding a input field + section, if they don't exist. But if they exist, whole adding fails.Can anyone please help with Apex code utilizing Apex metadata API (summer 17). Thanks.
We Need to change existing custom field in a managed package to a unique field. But seems the option is disabled.

User-added image

Any workaround for this please. Thanks.
We have Layout Read-only fields to be added. Seems like a bug, when we try to add read-only fields they become read-write on layout. Please see below example.
 
public class metadatatest {
    public static void runUpdateLayouts(){        
        Metadata.Layout la = getLayout('Account-Account Layout');

        Metadata.LayoutSection sec = new Metadata.LayoutSection();
        sec.customLabel = true;
        sec.detailHeading = true;
        sec.editHeading = true;
        sec.label = 'Custom fields';
        sec.style = metadata.LayoutSectionStyle.OneColumn;

        Metadata.LayoutColumn col1 = new Metadata.LayoutColumn();

        Metadata.LayoutItem layoutField = new Metadata.LayoutItem();

        layoutField.field = 'testfield__c';
        layoutField.behavior = metadata.UiBehavior.Readonly;

        col1.layoutItems.add(layoutField);
        sec.layoutColumns.add(col1);

        la.layoutSections.add(sec);

        Metadata.DeployContainer dc = new Metadata.DeployContainer();
        dc.addMetadata(la);

        Id jobid = Metadata.Operations.enqueueDeployment(dc,null);
    }

    public static Metadata.Layout getLayout(String layoutName){
        List<String> layoutList = new List<String>{layoutName};
            List<Metadata.Metadata> components = Metadata.Operations.retrieve(Metadata.MetadataType.Layout, layoutList);
        return (Metadata.Layout)components[0];
    }
}


Above code will add testfield__c field to Account standard layout. But it shows as Readonly in Layout editor. But in Account both view and edit modes it's read-write.

On Layout editor:
In Layout editor

On View/Edit mode:
Edit/View Mode

It's actually editable and saving data to Account object here. Feel free to try out above code snippet. Appreciate any fix/workaround for this. Thanks.

 
I'm trying to print content inside a div as below.
 
printPreview: function(component, event, helper) {
    	//window.print();
        
        
	   var divToPrint=component.find("printableDiv");
	   console.log('divToPrint.outerHTML: '+JSON.stringify(divToPrint.innerHTML));
	   newWin= window.open("");
	   newWin.document.write(divToPrint.outerHTML);
	   newWin.print();
	   newWin.close();
},

But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
I have linked the Trailhead account to Success profile sometime back. But the badge count seem to be different. Success community profile badges count is always several badges behind the Trailhead badges. Not sure why, any idea on this.

Thanks in advance.
Found this issue in Internet Explorer. Below is my code.

testApp.app​
<aura:application >
    <aura:attribute name="opp" type="Opportunity" default="{ 'sobjectType': 'Opportunity', 'Name':''}" access="public"/>
    <ui:inputText value="{!v.opp.Name}" keyup="{!c.readName}"/>
</aura:application>
JS Controller
 
({
    readName: function(component, event, helper) {

        if ((event.getParams().keyCode) != 13)
            return;

        var opp = component.get('v.opp');

        console.log('item: '+JSON.stringify(opp));
    },
})

In Internet Explorer
console.log() logs nothing for opp.Name
User-added image

In Firefox (Other browsers also works fine)


User-added image

I tried using a String type,also using keydown event, but doesn't seem to work for even simple String variables.Is this a bug in SF?
Appreciate any help on this?
Thanks.
 
We have below simple example visualforce page (to be used as inline VF page for Opportunity).
 
<apex:page standardController="Opportunity" >
    This page doesn't have any content.
</apex:page>

This page is added to Opportunity page layout for Partner Community User.
When we view as partner community user, it appears as a link as below.

User-added image

Because of this, it seems contents inline pages are not accessible. Also when we click on this page, it goes to 'Invalid page' community page which is not intended at all.
Any idea how we can remove this link behavior? Appreciate any help on this. Thanks.
 
We're having below markup in Lightning component.
<lightning:icon aura:id="statusIcon" iconName="action:check" size="xx-small"/>

When java-script is controller prints the page with this component, seems like it's omitting this icon.
 
window.print();


is used to print the page.

Is there a way I can get this icon on printed output? Appreciate any help. Thanks.
I created a brand new playground and searched for it in app exchange but no app exists to complete this challenge.
I'm trying to share a record for community user. Tried below code in Execute anonymous.
 
// Create new sharing object for the custom object.
myObject__Share objShare  = new myObject__Share();

// Set the ID of record being shared.
objShare.ParentId = 'a0Vf4000001Hprq'; //recordId;

// Set the ID of user or group being granted access.
objShare.UserOrGroupId = '005f4000000vjvX';

// Set the access level.
objShare.AccessLevel = 'Read';

insert objShare;

But unfortunately it fails with error "Line: 14, Column: 1
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: unknown (invalid user or group: 005f4000000vjvX): [unknown]" .

User-added image

Is it not possible to grant sharing access to community users via manual sharing? I could not find a related documention on it. Or should I set some configuration settings for this.
Appreciate any help. Thanks.

Note: This could have been achieved using Sharing sets in Community setttings, but due to design constraint we're not able to use it.


 
I'm trying to print content inside a div as below.
 
printPreview: function(component, event, helper) {
    	//window.print();
        
        
	   var divToPrint=component.find("printableDiv");
	   console.log('divToPrint.outerHTML: '+JSON.stringify(divToPrint.innerHTML));
	   newWin= window.open("");
	   newWin.document.write(divToPrint.outerHTML);
	   newWin.print();
	   newWin.close();
},

But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
I have linked the Trailhead account to Success profile sometime back. But the badge count seem to be different. Success community profile badges count is always several badges behind the Trailhead badges. Not sure why, any idea on this.

Thanks in advance.
How would I write the test for the below trigger?

trigger updtrichtextfld on Selected_Service__c (before insert) {
Set<Id> serviceIds = new set<Id>();
Map<Id, string> serviceMap = new Map<Id, string>();
for(Selected_Service__c ss : Trigger.new)
{
    serviceIds.add(ss.Service__c); //to fetch related Id
}
//Description field needs to be queried else will result in null
for(Service__c ser : [select id, Deliverables__c from Service__c where id in: serviceIds])
{
    serviceMap.put(ser.id, ser.Deliverables__c);
}
for(Selected_Service__c u : trigger.new)
{
    //Selected_Service__c.Custom_Description__c=Service__c.Deliverables__c; This is wrong
    u.Custom_Description__c = serviceMap.get(u.Service__c);
}
}

I have been able to write the following so far but it is giving me the error "Illegal assignment from List to Selected_Service__c"

@isTest

public class updtrichtextfldtest
{
    static testMethod void testUnit()
    {
     Selected_Service__c ss = new Selected_Service__c();
        ss = [
            SELECT Id, Deliverables__c
            From Service__c
            Where Id = :ss.Id
        ];
    }
}
hi,

Why soql query get only 250 records hit, even more records with equal conditions are exist?

Regards,
LinThaw
Could anyone please let me know why I'm getting the error Invalid selectOptions found. Use SelectOption type in Apex during preview of the below visualforce page

public  class DynamicApex {
    public Map<String ,Schema.SObjectType> gd {set;get;}
    public List<String> objlist {set;get;}
    public List<SelectOption> sop {set;get;}
    public  DynamicApex() 
    {
        objlist=new List<String>();
        sop=new List<SelectOption>();
        gd= Schema.getGlobalDescribe();
        objlist.addAll(gd.keyset());
        objlist.sort();
        System.debug(objlist);
        for(String s: objlist)
        {
            SelectOption sa= new SelectOption(s,s);
            sop.add(sa);

        }    }}

<apex:page controller="DynamicApex">
<apex:form>
  <apex:pageBlock>
    <apex:pageBlockSection>
      <apex:pageBlockSectionItem>
         <apex:outputLabel value="Select Object"/>
         <apex:selectList size="1">
            <apex:selectOptions value="{!objlist}"/>
         </apex:selectList>
      </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
  </apex:pageBlock>
</apex:form>      
</apex:page>
Hi,
I am stuck on the Atttributes and Expressions challenge of the lightening component basics:

I get the following message: The Name field is not being displayed using an expression.

I'm really not 100% sure how the display component is meant to work for Name and Packed status - as there seems to be no "<lightening: /> formatting markup available. 

Here is my code:

<aura:component>

    <aura:attribute name="item" type="Camping_Item__c" required="true" />

    <aura:attribute name="expense" type="Expense__c"/>
    
    <p>Name: 
        <lightning:String value="{!v.item.Name__c}" style="Text"/>
    </p>
    
    <p>Price:
        <lightning:formattedNumber value="{!v.item.Price__c}" style="Currency"/>
    </p>
    
    <p>Quantity:
        <lightning:formattedNumber value="{!v.item.Quantity__c}" style="Number"/>
    </p>
    
    <p>Packed Status:
        <lightning:Checkbox value="{!v.item.Packed__c}" style="Toggle"/>
    </p>

</aura:component>

Thanks for your assistance in advance.
Hi on step 3 of the trailhead badge « picklist Administration » I get this error see image. User-added image
The last challenge for the reports and dashboard beginner class is about Install an App from AppExchange.  When I attempt to load the CRM adoption dashboard package app I am getting an error message that the app is no longer available and has been removed. How can I complete this challenge?
How do you make lightning:inputRichText readonly, there is a disabled attribute. It seems not working yet. Is there a workaround to show it as a readonly field on page (by wrapping with a div tags may be).

markup:
<lightning:inputRichText value="{!v.richTextfield}" disabled="true" disabledCategories="FORMAT_FONT,FORMAT_TEXT,FORMAT_BODY,ALIGN_TEXT,REMOVE_FORMATTING"/>

 
We need to enable wrap text in lightning rich text field.  

Tried below markups including slds-scrollable_y, slds-hyphenate individually and together even in ui:outputRichText class attribute.

Markup:
<div aria-label="" class="slds-rich-text-area__content slds-grow slds-wrap slds-scrollable_y slds-hyphenate">
	<ui:outputRichText value="{!v.richtextFld}"/>
</div>

Am I doing it wrong? Appreciate any suggestions on this. 
Hello all,

I'm using Mobile SDK 5.1 with iOS and I'm trying to run it in a device with iOS 9.3.
My app is crashing on device but it works on emulator.

I'm getting this error on xcode:

dylddyld_fatal_error:
-> 0x1fe1b08c <+0>: trap
0x1fe1b090 <+4>: nop `

It's just happening in version 9.3 and it works for 10+.

Is anyone else here getting the same error?

I'm using xcode 8.2.1, cordova 6.4.0, iOS 4.3.0 and Salesfroce SDK 5.1.0.
 

Hi All

 

A new article has just been published on Developer Force:

 

  • An Introduction to Environments (link) - There are several types of environments available to you while developing and testing on Force.com. This article provides an outline of these environments. It will discuss the various editions, best practices and design considerations, and recommend particular environments during the application life-cycle.

 

As always, any feedback is welcome.

 

Thanks,
Jon