• yvk431
  • SMARTIE
  • 550 Points
  • Member since 2009

  • Chatter
    Feed
  • 20
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 59
    Questions
  • 257
    Replies

I am going through the SLDS trail as follows:
Trailhead > Develop for Lightning Experience > Lightning Design System > Use Images, Icons, and Avatars
https://trailhead.salesforce.com/trails/lex_dev/modules/lightning_design_system/units/lightning-design-system5

In the Page Header section, a box is supposed to display an avatar alongside the header text "Accounts / My Accounts".  What I get is a missing image indicator and the brower console gives me a 404 error.

The code in question looks like this:

<img src="{!URLFOR($Asset.SLDS, '/assets/images/avatar1.jpg')}" alt="" />

(along with appropriate spans and divs)   Looking into the Visualforce documentation, I see that the path to assets should be without the leading slash, so the code should look like this:

<img src="{!URLFOR($Asset.SLDS, 'assets/images/avatar1.jpg')}" alt="" />
but that doesn't work, either.

Question:  how do you reference Salesforce assets in this context?

My full code is below.  (This whole module is very difficult to use because the code samples appear all on one (long) line without line breaks, making them very difficult to copy/paste.)
 

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" 
           applyHtmlTag="false" applyBodyTag="false" docType="html-5.0"> 
    <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en"> 
        <head> 
            <meta charset="utf-8" /> 
            <meta http-equiv="x-ua-compatible" content="ie=edge" /> 
            <title>Salesforce Lightning Design System Trailhead Module</title> 
            <meta name="viewport" content="width=device-width, initial-scale=1" /> 
            <!-- Import the Design System style sheet --> 
            <apex:slds /> 
        </head> 
        <apex:remoteObjects > 
            <apex:remoteObjectModel name="Account" fields="Id,Name,LastModifiedDate"/> 
        </apex:remoteObjects> 
        <body>            
            <!-- REQUIRED SLDS WRAPPER --> 
            <div class="slds-scope"> 
                <!-- MASTHEAD --> 
                <p class="slds-text-heading--label slds-m-bottom--small"> 
                    Salesforce Lightning Design System Trailhead Module 
                </p> 
                <!-- / MASTHEAD --> 
                <!-- PAGE HEADER --> 
                <div class="slds-page-header" role="banner"> 
                    <div class="slds-grid"> 
                        <div class="slds-col slds-has-flexi-truncate"> 
                            <!-- HEADING AREA --> 
                            <div class="slds-media slds-no-space slds-grow"> 
                                <div class="slds-media__figure"> 
                                    <span class="slds-avatar slds-avatar--medium"> 
                                        <img src="{!URLFOR($Asset.SLDS, 'assets/images/avatar1.jpg')}" 
                                             alt="" />
                                    </span> 
                                </div> 
                                <div class="slds-media__body"> 
                                    <p class="slds-text-title--caps slds-line-height--reset">
                                        Accounts
                                    </p> 
                                    <h1 class="slds-page-header__title slds-m-right--small slds-align-middle slds-truncate" 
                                        title="My Accounts">
                                        My Accounts
                                    </h1> 
                                </div> 
                            </div> 
                            <!-- / HEADING AREA -->
                        </div> 
                        <div class="slds-col slds-no-flex slds-grid slds-align-top"> 
                            <button class="slds-button slds-button--neutral">
                                New Account
                            </button> 
                        </div> 
                    </div> 
                    <div class="slds-grid"> 
                        <div class="slds-col slds-align-bottom slds-p-top--small"> 
                            <p class="slds-text-body--small page-header__info">
                                COUNT items
                            </p> 
                        </div> 
                    </div> 
                </div> 
                <!-- / PAGE HEADER -->                
                <!-- PRIMARY CONTENT WRAPPER --> 
                <div class="myapp"> 
                    <!-- CREATE NEW ACCOUNT --> 
                    <div aria-labelledby="newaccountform"> 
                        <!-- CREATE NEW ACCOUNT FORM --> 
                        <form class="slds-form--stacked" id="add-account-form"> 
                            <!-- BOXED AREA --> 
                            <fieldset class="slds-box slds-theme--default slds-container--small"> 
                                <legend id="newaccountform" class="slds-text-heading--medium slds-p-vertical--medium">
                                    Add a new account
                                </legend> 
                                <div class="slds-form-element"> 
                                    <label class="slds-form-element__label" for="account-name">
                                        Name
                                    </label> 
                                    <div class="slds-form-element__control"> 
                                        <input id="account-name" class="slds-input" type="text" 
                                               placeholder="New account"/> 
                                    </div> 
                                </div> 
                                <button class="slds-button slds-button--brand slds-m-top--medium" type="submit">
                                    Create Account
                                </button> 
                            </fieldset> 
                            <!-- / BOXED AREA --> 
                        </form> 
                        <!-- CREATE NEW ACCOUNT FORM --> 
                    </div> 
                    <!-- / CREATE NEW ACCOUNT -->
                    <!-- ACCOUNT LIST TABLE --> 
                    <div id="account-list" class="slds-p-vertical--medium">
                        
                    </div> 
                    <!-- / ACCOUNT LIST TABLE --> 
                </div> 
                <!-- / PRIMARY CONTENT WRAPPER -->
                
                <!-- FOOTER --> 
                <footer role="contentinfo" class="slds-p-around--large"> 
                    <!-- LAYOUT GRID --> 
                    <div class="slds-grid slds-grid--align-spread"> 
                        <p class="slds-col">Salesforce Lightning Design System Example</p> 
                        <p class="slds-col">&copy; Your Name Here</p> 
                    </div> 
                    <!-- / LAYOUT GRID --> 
                </footer> 
                <!-- / FOOTER -->            
            </div> 
            <!-- / REQUIRED SLDS WRAPPER --> 
            <!-- JAVASCRIPT --> 
            <script> 
            (function() { 
                var account = new SObjectModel.Account(); 
                var outputDiv = document.getElementById('account-list'); 
                var updateOutputDiv = function() { 
                    account.retrieve( { 
                        orderby: [{ LastModifiedDate: 'DESC'}, 
                                  { Name: 'ASC'}
                                 ]//, 
                        //limit: 10 
                    }, function(error, records) { 
                        if (error) { 
                            alert(error.message); 
                        } else { 
                            // create data table 
                            var dataTable = document.createElement('table'); 
                            dataTable.className = 'slds-table slds-table--bordered slds-table--cell-buffer slds-no-row-hover'; 
                            // add header row 
                            var tableHeader = dataTable.createTHead(); 
                            var tableHeaderRow = tableHeader.insertRow(); 
                            var tableHeaderRowCell1 = tableHeaderRow.insertCell(0); 
                            tableHeaderRowCell1.appendChild(document.createTextNode('Account name')); 
                            tableHeaderRowCell1.setAttribute('scope', 'col'); 
                            tableHeaderRowCell1.setAttribute('class', 'slds-text-heading--label'); 
                            var tableHeaderRowCell2 = tableHeaderRow.insertCell(1); 
                            tableHeaderRowCell2.appendChild(document.createTextNode('Account ID')); 
                            tableHeaderRowCell2.setAttribute('scope', 'col'); 
                            tableHeaderRowCell2.setAttribute('class', 'slds-text-heading--label'); 
                            var tableHeaderRowCell3 = tableHeaderRow.insertCell(2); 
                            tableHeaderRowCell3.appendChild(document.createTextNode('Last Mod')); 
                            tableHeaderRowCell3.setAttribute('scope', 'col'); 
                            tableHeaderRowCell3.setAttribute('class', 'slds-text-heading--label'); 
                            // build table body 
                            var tableBody = dataTable.appendChild(document.createElement('tbody')); 
                            var dataRow, dataRowCell1, dataRowCell2, dataRowCell3, recordName, recordId; 
                            records.forEach(function(record) { 
                                dataRow = tableBody.insertRow(); 
                                dataRowCell1 = dataRow.insertCell(0); 
                                recordName = document.createTextNode(record.get('Name')); 
                                dataRowCell1.appendChild(recordName); 
                                dataRowCell2 = dataRow.insertCell(1); 
                                recordId = document.createTextNode(record.get('Id')); 
                                dataRowCell2.appendChild(recordId); 
                                dataRowCell3 = dataRow.insertCell(2); 
                                lastMod = document.createTextNode(record.get('LastModifiedDate')); 
                                dataRowCell3.appendChild(lastMod); 
                            }); 
                            if (outputDiv.firstChild) { 
                                // replace table if it already exists 
                                // see later in tutorial 
                                outputDiv.replaceChild(dataTable, outputDiv.firstChild); 
                            } else { 
                                outputDiv.appendChild(dataTable); 
                            } 
                        } 
                    } ); 
                } 
                updateOutputDiv(); 
            })(); 
            var accountForm = document.getElementById('add-account-form'); 
            var accountNameField = document.getElementById('account-name'); 
            var createAccount = function() { 
                var account = new SObjectModel.Account(); 
                account.create({ Name: accountNameField.value }, 
                               function(error, records) { 
                                   if (error) { 
                                       alert(error.message); 
                                   } else { 
                                       updateOutputDiv(); 
                                       accountNameField.value = ''; 
                                   } 
                               }); 
            } 
            accountForm.addEventListener('submit', 
                                         function(e) { 
                                             e.preventDefault(); 
                                             createAccount(); 
                                         }
                                        );
            </script> 
            <!-- / JAVASCRIPT -->
        </body> 
    </html> 
</apex:page>
I'm trying to go through the Field Service trail an when in the module "Enable Field Service and Create Service Resources" I'm not able to find the "Service Resource" in the App Launcher after activating field service and setting my user.

Tried it on a colleagues Trailhead playground and it worked for him.

Anyone who can help understand why my trailhead playground doesn't allow me to access Service Resource?

Thanks!
Hi All,

I dont know how to put it, I am given with this crazy idea to build an custom visual force page for the auto selection of the products/services based on comparions of the inputs given on opportunity. Meaning the comparision between the inputs needs to be varied by the users in a timely fashion and apex should not hard code the comparisions , instead it should get the comparision criteria from a different object's records so as to allow the users to change them from time to time.

Before starting on anything, I just wanted to make sure that apex code can handle this kind of scenario. Please let me know.

--yvk
Hello everyone,

Can you set a standard object as a junction object using Apex code? 

I do understand that this is not possible to achieve this through Point and Click, also there are hidden standard objects(not available on the UI) that are junction objects viz. AccountContactRole.

Thanks in advance.
We have two object say A and B. 
A has a lookup on B. 
A has two text field Type and year.
B has one text field Type and year
I want to populate the lookup field of A by matching Type and Year field of A with type and Year field of B. Trigger code should be bulkified. Need help, its urgent. Thank you
How can I make a field required only if a certain item is selected in a seperate picklist field on the same custom object?
I am not sure what is incorrect in this trigger. I am getting Error: Compile Error: unexpected token: 'for' at line 4 column 1

Scenario:
- After creating a new Opportunity
- Object Implementation should populate a list of 12 Records when save is clicked. 
trigger IMP on Opportunity (after insert) { 
 List <implementation__c> ImpToInsert = new List <implementation__c> 

 for (Opportunity o : Trigger.new) {
  implementation__c rec = new implementation__c (Opportunity__c = o.id); 
  ImpToInsert.add(rec);
}

database.saveResult[] sr = database.insert(impToInsert,false);  

for(integer x=0;x<sr.size();x++){
  if(sr[x].isSuccess() == false)
      system.debug(logginglevel.error,sr[x].getErrors()[0].getMessage());
 }
}
hi, 
 Actually i dont know what to do here to achive my logic.

my required condition is ,  there is a course in COURSE__C object, we need 2 values to perfoam reqiored operation,  

1) Total_no_of_seats__C  (i am giving it as 60)   no problem at here.
2)Total_students_booked_seats_upto_now( i need this) 

because i need to write some validation rule at student_registration_for_new couse....  please help

validation rule at student__C object is

User-added image
 
Hi All

I have one urgent query, described below:
I have one custom object "Communication" with two record types 'Inbound' & 'Outbound'. I created one custom button on Inbound layout called 'Reply'.
Functianality on Reply button is:

functionality to Reply to a Communication is a custom 'Reply' button that has code to clone the original Communication record (thus preserving the original), change the Record Type to Outbound and open the new record in Edit view.

Just similar to mailing pattern to reply, the cloning record will contain the Subject, Recipient email, Message type, Reply content(these are the fields) to auto populate from Inbound record type record and in editable mode. and have below section in which the clone of original mail will come.

Please help me in solving this problem.

Regards
Manav 


 
How can I add Summary Report without chart in a page layout?
As of now I am trying to create one VF page which I will add as inline VF page in layout, but the below code is not showing any results, its just showing white screen.

Thanks
<apex:page showHeader="false" sidebar="false">
  <apex:OutputPanel id="MissingAttRpt" >
        <apex:iframe src="/00Og000000hMj0h?isdtp=lt" scrolling="true"  height="1588px"  width="100%"/>   
  </apex:OutputPanel>
</apex:page>

 

How to make apex:inputfile as required?

i have used the following code,

<apex:inputFile value="{!objAttachment1.body}" filename="{!objAttachment1.name}" required="true">
</apex:inputFile>

It dint workout. Any help on how to achieve this?

Thanks.

 

I am not sure if my subject is clear, but hopefully this helps.

I am working on a Site with a Product search feature for different divisions (division__C)

I want each division search page to only search for products of that division.

I have a search feature working, just need help tweaking it.  I have tried some things on my own with no luck, so I am hoping I can get some help.

1. If I change the class to say
WHERE Division__C = Office/School AND Area__C...

it says Authorization Required on search (Guest has field access)
I have a search feature working, just need help tweaking it.

2. If I change class to say
...OR Case_Quantity__c like \'%'+searchstring+'%\' AND Division__c like \'%'+Office/School+'%\''

it says Error    Error: Compile Error: Variable does not exist: Office at line 15 column 521

_____________

Working code:

public with sharing class prodsearchschool {

    private String sortOrder = 'Name';
    public list <Product2> Prod {get;set;} 
    public String searchstring {get;set;}
    public String searchquery {get;set;}
    public String sortField {get;set;}
    public String lastClicked {get;set;}
    public String sortDir {get;set;}

    public prodsearchschool() {}
     
         
    public PageReference search(){
        searchquery='select Area__C, ProductCode, Name, Color__C, Overall_Length__C, H__C, W__C, L__C, Case_Quantity__c from Product2 WHERE Area__C like \'%'+searchstring+'%\' OR ProductCode like \'%'+searchstring+'%\' OR Name like \'%'+searchstring+'%\' OR Color__C like \'%'+searchstring+'%\' OR Overall_Length__C like \'%'+searchstring+'%\' OR H__C like \'%'+searchstring+'%\' OR L__C like \'%'+searchstring+'%\' OR W__C like \'%'+searchstring+'%\' OR Case_Quantity__c like \'%'+searchstring+'%\'';  
        Prod = database.query(searchquery);
        return null;
    } 

    public void clear(){ 
        prod.clear(); 
    }

    public PageReference sortThis() {  
        if(lastClicked == null){
            sortDir = 'ASC';
        }
        else{
            if(lastClicked == sortField){
                sortDir = 'DESC';
            }
            else{
                sortDir = 'ASC';
            }
        }
        lastClicked = sortField;
       prod = Database.query(searchquery + ' order by ' + sortField + ' ' + sortDir);
       return null;
    } 
}
Hi All,

I could see Save and Cancel buttons in my VFP. But Save button is not highlighted and it isn't working. I used the same code as above. Please help.
Belowe code i used for this.

https://gist.github.com/Karanraj/6bd1ffc13252b0a22ae0
Hi all,

I was wondering if anyone could help me embed some of my dashboard components into a visualforce page. After every week the dashboard needs to display different informatrion on different records and the only way to do this is to embed them in a visualforce page. I am new to this and am not sure how I would achiecve this.

If somebody could give me some help and a bit of code that would be much appreciated. 

Thanks
Hi all,

Am building a community with the customer community plus license. Client is not new to salesforce.com. They are using it already and they have built few standard reports (tabular, summary, matrix) using standard reports and dashboards. Now, since we are building the community, client needs to see the already generated report continuously inside the community (VF pages). 

I was seeing the documents to display the already generated standard reports in community using the visualforce page, but i could not find the correct documentation which says it is possible and how. 

Is there any documentation or example for displaying the standard tabular/summary/matrix reports in community visualforce pages? Please advise. 

Thanks
 
After Winter release we encountered an issue for our .Net integration related to Soap API schema WSDL.
It is a known issue with the XML serialization class from .NET Framework all versions. The XMLSerializer code generation component cannot handle the XSD definitions that have only one element and the occurrence of the element is unbounded.
This is the case with the newly introduced classes ListViewRecord and ListViewRecordColumn from Salesforce API 32.0.
We had to manually modify the schema and altered the constructors for those 2 classes mentioned above by adding an extra dummy attribute.
This way the XMLSerializer code generator will use the proper XmlSerialization attributes for the constructor.

There should be a way to update WSDL from Salesforce to support .Net integration without manually update

Thank you! 

the above error i am getting wen i am executing thi program..... plz help me

 

 

 

 

public with sharing class ChatterUnitTests {

/*
* Test the ChatterActivity trigger which inserts chatter feed posts whenever a task is inserted on the parent object
*/
public static testMethod void testChatterActivity() {
//create the test account

Account a = new Account(name='Test Account');
insert a;

//create a task on that account
Task t = new Task(whatId=a.id);
t.Subject = 'This is a test activity for chatter';
t.ActivityDate = System.today();
t.Status = 'In Progress';
t.Description = 'Hello, this will be chattered';

insert t;

//Make sure Account has the feed enabled. If it does, make sure the chatter feed post is there
Schema.DescribeSObjectResult r = Account.SObjectType.getDescribe();
if (r.isFeedEnabled()) {
List<AccountFeed> posts = [SELECT Id, Type FROM AccountFeed WHERE ParentId = :a.id];
System.assertEquals(1, posts.size());
}
}
}

In the User's Guide there is a sample http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm?CSHID=apex_methods_system_test.htm#TestLoadDataExampleSection

of how to use the Test.loadData method to load a csv file with Accounts.

 

I cannot see any documentation nor samples showing how to load records with references (lookup or master-detail) to parent records - e.g. if I want to load Contacts, which refer to Accounts.

 

Anyone who knows. I suppose I am not going to "invent" record IDs????

Hi Boards,

I have some data populated in richtext Area fields in sandbox.

I would like to migrate them to production.

 

RichTextArea contains embedded images, I would like them to be exported them as is.

I took the export using DataLoader and the csv file shows the path of the image instead of the image data. How do I accomplish the export  ?

 

Any insights will be appreciated.

 

Thanks,