-
ChatterFeed
-
2Best Answers
-
2Likes Received
-
2Likes Given
-
19Questions
-
44Replies
The Name field is not being displayed using an expression.
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.
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.
- Peter McGavin
- October 19, 2017
- Like
- 0
- Continue reading or reply
Display a numbered list on Visualforce Page
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?
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?
- John Gardiner
- September 07, 2017
- Like
- 0
- Continue reading or reply
How do I keep Product namespace in DX Org after migrating from DE?
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.
- Pasan Eeriyagama
- May 31, 2018
- Like
- 0
- Continue reading or reply
Lightning component Attribute value is not set in Internet Explorer 11
Found this issue in Internet Explorer. Below is my code.
testApp.app
In Internet Explorer
console.log() logs nothing for opp.Name
In Firefox (Other browsers also works fine)
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.
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
In Firefox (Other browsers also works fine)
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.
- Pasan Eeriyagama
- February 21, 2018
- Like
- 0
- Continue reading or reply
Inline Visualforce page is displayed as a link, any idea why? and how to remove the link behavior?
We have below simple example visualforce page (to be used as inline VF page for Opportunity).
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.
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.
<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.
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.
- Pasan Eeriyagama
- December 11, 2017
- Like
- 0
- Continue reading or reply
How to print Lightning icon?
We're having below markup in Lightning component.
When java-script is controller prints the page with this component, seems like it's omitting this icon.
is used to print the page.
Is there a way I can get this icon on printed output? Appreciate any help. Thanks.
<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.
- Pasan Eeriyagama
- December 06, 2017
- Like
- 0
- Continue reading or reply
How to share record with a community user?
I'm trying to share a record for community user. Tried below code in Execute anonymous.
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]" .
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.
// 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]" .
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.
- Pasan Eeriyagama
- November 07, 2017
- Like
- 0
- Continue reading or reply
How to print a div content in a Lightning component?
I'm trying to print content inside a div as below.
But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
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.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
Why success profile traihead badge count is different from trailhead profile's badge count?
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.
Thanks in advance.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
Getting Lightning run-time exception: SecureWindow.open supports http://, https:// schemes and relative urls
Hi,
I'm trying to print preview a lightning component using below.
But it's throwing Lightning exception as below.
Any suggestions/workaround to get this working please. Thanks.
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.
Any suggestions/workaround to get this working please. Thanks.
- Pasan Eeriyagama
- October 25, 2017
- Like
- 0
- Continue reading or reply
lightning tabset does not work in iOS or Android mobiles?
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.
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.
- Pasan Eeriyagama
- October 23, 2017
- Like
- 0
- Continue reading or reply
Lightning:tabset does not refresh on mobile devices?
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,
After clicking on different tab it will be refreshed to below.
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.
This can be simulated on browser as well. When it appears on a mobile device initially it appears as,
After clicking on different tab it will be refreshed to below.
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.
- Pasan Eeriyagama
- October 20, 2017
- Like
- 0
- Continue reading or reply
How to make lightning:inputRichText Readonly?
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:
markup:
<lightning:inputRichText value="{!v.richTextfield}" disabled="true" disabledCategories="FORMAT_FONT,FORMAT_TEXT,FORMAT_BODY,ALIGN_TEXT,REMOVE_FORMATTING"/>
- Pasan Eeriyagama
- October 03, 2017
- Like
- 0
- Continue reading or reply
How to enable wrap text in ui:outputRichText?
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:
Am I doing it wrong? Appreciate any suggestions on this.
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.
- Pasan Eeriyagama
- September 28, 2017
- Like
- 0
- Continue reading or reply
Trialforce Org derived new instance does not run triggers?
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).
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).
- Pasan Eeriyagama
- September 14, 2017
- Like
- 0
- Continue reading or reply
How to embed RecordDetail lightning component into our own custom component?
I'm trying to get below lightning component into a own custom component.
Seems not exposed to embed, just tried below and no luck.
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.
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.
- Pasan Eeriyagama
- September 07, 2017
- Like
- 0
- Continue reading or reply
How to enable community users to update their contact fields?
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.
- Pasan Eeriyagama
- September 05, 2017
- Like
- 0
- Continue reading or reply
No such column 'QuantityUnitOfMeasure' on entity 'Product2'
I'm trying to read Unit of Measure on Product2. But getting compile time error as below.
But in Product entity field seems there.
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.
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.
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.
- Pasan Eeriyagama
- August 03, 2017
- Like
- 0
- Continue reading or reply
How to update Layout input field label text if exists, and add if it doesn't exist under a section?
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.
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.
- Pasan Eeriyagama
- July 17, 2017
- Like
- 0
- Continue reading or reply
How to change existing custom field in a managed package to unique?
We Need to change existing custom field in a managed package to a unique field. But seems the option is disabled.
Any workaround for this please. Thanks.
Any workaround for this please. Thanks.
- Pasan Eeriyagama
- June 20, 2017
- Like
- 0
- Continue reading or reply
Apex Metadata API Layout Read-only fields being added as Read-write
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.
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:
On View/Edit 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.
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:
On View/Edit 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.
- Pasan Eeriyagama
- June 19, 2017
- Like
- 0
- Continue reading or reply
How to print a div content in a Lightning component?
I'm trying to print content inside a div as below.
But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
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.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
Why success profile traihead badge count is different from trailhead profile's badge count?
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.
Thanks in advance.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
Lightning component Attribute value is not set in Internet Explorer 11
Found this issue in Internet Explorer. Below is my code.
testApp.app
In Internet Explorer
console.log() logs nothing for opp.Name
In Firefox (Other browsers also works fine)
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.
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
In Firefox (Other browsers also works fine)
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.
- Pasan Eeriyagama
- February 21, 2018
- Like
- 0
- Continue reading or reply
Inline Visualforce page is displayed as a link, any idea why? and how to remove the link behavior?
We have below simple example visualforce page (to be used as inline VF page for Opportunity).
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.
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.
<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.
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.
- Pasan Eeriyagama
- December 11, 2017
- Like
- 0
- Continue reading or reply
How to print Lightning icon?
We're having below markup in Lightning component.
When java-script is controller prints the page with this component, seems like it's omitting this icon.
is used to print the page.
Is there a way I can get this icon on printed output? Appreciate any help. Thanks.
<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.
- Pasan Eeriyagama
- December 06, 2017
- Like
- 0
- Continue reading or reply
Install Apps and Packages in Your Trailhead Playground - Dreamhome app is not in AppExchange for me to select.
I created a brand new playground and searched for it in app exchange but no app exists to complete this challenge.
- Mary Brauch
- November 09, 2017
- Like
- 0
- Continue reading or reply
How to share record with a community user?
I'm trying to share a record for community user. Tried below code in Execute anonymous.
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]" .
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.
// 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]" .
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.
- Pasan Eeriyagama
- November 07, 2017
- Like
- 0
- Continue reading or reply
How to print a div content in a Lightning component?
I'm trying to print content inside a div as below.
But this did not work. Anyone got a working example to print within Lightning components please. Appreciate any help. Thanks.
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.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
Why success profile traihead badge count is different from trailhead profile's badge count?
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.
Thanks in advance.
- Pasan Eeriyagama
- October 30, 2017
- Like
- 1
- Continue reading or reply
How To Write Test for Before Insert Trigger
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
];
}
}
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
];
}
}
- Kristi Gray
- October 23, 2017
- Like
- 0
- Continue reading or reply
Soql query get only 250 records hit?
hi,
Why soql query get only 250 records hit, even more records with equal conditions are exist?
Regards,
LinThaw
Why soql query get only 250 records hit, even more records with equal conditions are exist?
Regards,
LinThaw
- LinThaw
- October 19, 2017
- Like
- 0
- Continue reading or reply
Invalid selectOptions found. Use SelectOption type in Apex.
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>
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>
- THARUN REDDY BOMMAREDDY
- October 19, 2017
- Like
- 0
- Continue reading or reply
The Name field is not being displayed using an expression.
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.
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.
- Peter McGavin
- October 19, 2017
- Like
- 0
- Continue reading or reply
Trailhead: Share Values with Global Value Sets
Hi on step 3 of the trailhead badge « picklist Administration » I get this error see image.
- Stephane Plancke
- October 18, 2017
- Like
- 1
- Continue reading or reply
Install an App from AppExchange
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?
- Sue Cannon
- October 18, 2017
- Like
- 0
- Continue reading or reply
How to make lightning:inputRichText Readonly?
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:
markup:
<lightning:inputRichText value="{!v.richTextfield}" disabled="true" disabledCategories="FORMAT_FONT,FORMAT_TEXT,FORMAT_BODY,ALIGN_TEXT,REMOVE_FORMATTING"/>
- Pasan Eeriyagama
- October 03, 2017
- Like
- 0
- Continue reading or reply
How to enable wrap text in ui:outputRichText?
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:
Am I doing it wrong? Appreciate any suggestions on this.
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.
- Pasan Eeriyagama
- September 28, 2017
- Like
- 0
- Continue reading or reply
App Crashing on IOS 9.3
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.
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.
- Thiago Pandô
- June 12, 2017
- Like
- 1
- Continue reading or reply
An Introduction to Environments (aka orgs)
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
- Jon Mountjoy_
- April 23, 2009
- Like
- 3
- Continue reading or reply