+ Start a Discussion
sherry pengsherry peng 
In Lightning Component Framework Specialist SuperBadge - Challenge 8, I got following error:
The BoatReview component doesn't include a public attribute named boat of type BoatType__c.
Best Answer chosen by sherry peng
sherry pengsherry peng
I waste hours on fixing it. The error message is misleading. Actually it is looking for a public attribute named boat of type Boat__c on BoatReviews component. 

For this super badge, no need to create a BoatReview component. 

Post here to save your time if you got this error also. 
Clinton HatcherClinton Hatcher 
Hi all, i am new to this so thanks in advance for help. I am struggling to create a test class for my Invocable Method. I just cant get it to work - i keep getting the error Method Does not exist Or incorrect Signature. I know i am doing something wrong. Below is the two classes - 
 
public class PrevetActive4 {

    
@InvocableMethod(label='Get Prevett and update MATT' description='Returns the list of Prevett names corresponding to the specified account IDs.')
  
    public static void getPrevett2(List<Id> Ids) {

       
        List<Prevet_Checklist__c> mt = [Select Name, id,Active_Prevett__c, Open_Closed__c FROM Prevet_Checklist__c WHERE Id in :Ids AND Open_Closed__c = 'Queue' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       
        for (Prevet_Checklist__c one1 : mt) {
            one1.Open_Closed__c = 'Ready';
            one1.Active_Prevett__c = true;
            
            
        }
        update mt ;

}
}
 
@IsTest
private class TEST_Prevett2

{
    private static testMethod void myPrevettTest2() 
    {

     
       Prevet_Checklist__c PV = new Prevet_Checklist__c(Open_Closed__c = 'Queue', Active_Prevett__c = False, OwnerId = '00528000000kb5s');

       Insert PV;
        
       
       PrevetActive4.getPrevett2(PV);

    
       Prevet_Checklist__c result = [Select ID, OwnerId, Open_Closed__c, Name, Active_Prevett__c, Client_Name__c, Name_of_Adviser__c From Prevet_Checklist__c WHERE Open_Closed__c = 'Ready' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       System.assertEquals('Ready', result.Open_Closed__c);
       System.assertEquals(True, result.Active_Prevett__c);



    }
}



Thanks
 
Best Answer chosen by Clinton Hatcher
shailesh rawte 1shailesh rawte 1
Hi Clinton Hatcher,


In getPrevett2 method you declare list of id as parameter.
But in test class your passing object only.
so just add id into list and pass it from test class.
refer following code after Insert.

List<id> listid=new list<id>();
listid.add(PV.id);
PrevetActive4.getPrevett2(listid);



Thanks & Regards
Shailesh Rawte
 
Ram Shiva KumarRam Shiva Kumar 
hi,

i have set the OWD to public read/write and  profile is read only .  i have a sharing rule ( with read/ write)in which  user A wants to share that record to the another user B (in the same profile) .here i have doubt is whether the second user can edit the records or not.

1)and my secod question is profile over rides the OWD....? 

 
Best Answer chosen by Ram Shiva Kumar
Medhya MahajanMedhya Mahajan
Hi Ram, 

OWD - Controls Record Access.
Sharing Rule - Controls Record Level Access.
Profile - Object Level Access

According to your first question, no the user cannot edit the records for other user ( sharing rule will not be created, will give an error that profile is read only) . However they can see each others record.

See Link : http://salesforce.stackexchange.com/questions/60656/profile-permissions-v-s-org-wide-defaults

Coming to your second question :

Profile works on object and OWD on record ( they are two different things ). 
It won't be a good idea to say that profile over rides OWD. But yes, Profile level permisson have a high preference, hence Profile permission will stand.

Consider a case where
OWD - Private
Profile - Read /Write
In this case he users will not be able to edit each others record due to OWD being private.

However, in your scenario due to profile access being Read Only users cannot edit each others data.

Mark as solved if it helps.

Regards
Medhya Mahajan
 
Ryan Adams 173Ryan Adams 173 
Please help me resolve this challenge:

https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_soap_callouts

The Challenge is as follows:

Generate an Apex class using WSDL2Apex and write a test class.
Generate an Apex class using WSDL2Apex for a SOAP web service, write unit tests that achieve 100% code coverage for the class using a mock response, and run your Apex tests.

Use WSDL2Apex to generate a class called 'ParkService' in public scope using this WSDL file. After you click the 'Parse WSDL' button don't forget to change the name of the Apex Class Name from 'parksServices' to 'ParkService'.
Create a class called 'ParkLocator' that has a 'country' method that uses the 'ParkService' class and returns an array of available park names for a particular country passed to the web service. Possible country names that can be passed to the web service include Germany, India, Japan and United States.
Create a test class named ParkLocatorTest that uses a mock class called ParkServiceMock to mock the callout response.
The unit tests must cover all lines of code included in the ParkLocator class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

The error I receive when checking the challencge is:

Challenge Not yet complete... here's what's wrong:
Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String and returns an array of Strings from the web service.

Here is the code I am using:
public class ParkLocator {
    public static String[] country(String ctry) {
        ParkService.ParksImplPort prk = 
            new ParkService.ParksImplPort();
        return prk.byCountry(ctry);
    }
}

and
 
@isTest
global class ParkServiceMock implements WebServiceMock {
   global void doInvoke(
           Object stub,
           Object request,
           Map<String, Object> response,
           String endpoint,
           String soapAction,
           String requestName,
           String responseNS,
           String responseName,
           String responseType) {
        // start - specify the response you want to send
        ParkService.byCountryResponse response_x = 
            new ParkService.byCountryResponse();
            
        List<String> myStrings = new List<String> {'Park1','Park2','Park3'};
    
        response_x.return_x = myStrings;
        // end
        response.put('response_x', response_x); 
   }
}

and
 
@isTest
private class ParkLocatorTest  {
    @isTest static void testCallout() {              
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new ParkServiceMock());
        // Call the method that invokes a callout
        List<String> result = new List<String>();
        List<String> expectedvalue = new List<String>{'Park1','Park2','Park3'};
        
        result = ParkLocator.country('India');
        // Verify that a fake result is returned
        System.assertEquals(expectedvalue, result); 
    }
}

Any help which can be provided is greatly appreciated.  If you could advise me at raadams173@gmail.com if you reply with a solution, I can log in to check it.

Thanks.

Ryan
Best Answer chosen by Ryan Adams 173
Amit Singh 1Amit Singh 1
Hello Ryan,

Use below code for ParkLocator class.
public class ParkLocator {
    public static String[] country(String country){
        ParkService.ParksImplPort parks = new ParkService.ParksImplPort();
        String[] parksname = parks.byCountry(country);
        return parksname;
    }
}
If this not resolves the problem then use a new Developer Org for completing the Challenge.

Let me know if this helps :)

 
Jason Akai - devJason Akai - dev 

Hello all

I downloaded and started using the Org w/ the Dreamhouse App pre-built, and went through the trailhead for "Create a Lightning Console App"

https://trailhead.salesforce.com/trails/lex_admin_migration/projects/migrate-a-classic-app-to-lightning-experience-with-declarative-tools/steps/create-a-lightning-console-app

When I get to the end - I can't seem to get past  this error - 
Challenge Not yet complete... here's what's wrong: 
Could not find a Lightning App with the name 'Dreamhouse Console'.

So - that leads me to believe that the default org I have selected in the verify step is wrong, but it isnt (I've tried all of them).  
I have also deleted and rebuilt the console app from scratch, and still nothing.  

Any thoughts or advice?

Best Answer chosen by Jason Akai - dev
Dharmendra KaramchandaniDharmendra Karamchandani

Hi Jason, 

Just read your concern and also completed the Improve Your Classic App by Moving It to Lightning Experience project today.
Regarding your concern I would like to share my views:

1. Sign up a new developer org with the following URL to have all the require things pre-build in the org(users, report, objects etc).

  • https://developer.salesforce.com/promotions/orgs/lightningnow/

2. Please follow all the steps defined in the step Create a Lightning Console App for creating ligthning app using Lightning App Manager by swtiching in LIGHTNING EXPERIENCE.

User-added image
  • While creating this App you also have to set App's image that you can download from the following URL:
    • ​https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Human-go-home.svg/128px-Human-go-home.svg.png

Please proceed with my views and share your feedback.

Thanks!

Eric Anderson 54Eric Anderson 54 
Hi there,

I have two custom objects. The Investigation__c is the parent object, and the Time_Entry_Recap_Report__c is the child object. What I want to have happen is when the parent record (Investigation) is initially created, I want to create an initial entry in the 'Time_Entry_Recap_Report__c' with 15 minutes of time worked and a description of the task being 'Opened new investigation'. I'm trying to figure out how to relate the Child record to the parent record when I create the entry in the trigger. The object 'Time_Entry_Recap_Report__c' is already defined as a child to the parent, but trying to insert the record without a reference to the 'Investigation_Time_Entry__c' field within the 'Time_Entry_Recap_Report__c' object didn't work either. The Error I am getting is "Error: Compile Error: Illegal assignment from Schema.SObjectField to Id at line 8 column 7. Any assistance would be greatly appreicated. 
trigger CreateTimeEntry on Investigation__c (after insert) {
    List<Time_Entry_Recap_Report__c> entryList = new List<Time_Entry_Recap_Report__c>();
    for(Investigation__c InvestigationObj : Trigger.new){
    Time_Entry_Recap_Report__c entry = new Time_Entry_Recap_Report__c();
      entry.Hours_Worked__c = '00';
      entry.Minutes_Worked__c = '15';
      entry.Work_Performed__c = 'Opened new investigation';
      entry.Investigation_Time_Entry__c = Investigation__c.NAME;
      entryList.add(entry);
     }
     if(entryList.size()>0){
      upsert entryList;
     }
}

 
Best Answer chosen by Eric Anderson 54
Prashant Pandey07Prashant Pandey07
Hi Eric,

As @Varaprasad suggested that use the id instead of Name..name is not a valid type for the ID.. and don't use upsert because you are executing trigger only on Insert.. I have modified the code that may help you..
 
trigger CreateTimeEntry on Investigation__c (After Insert) {

     set<id>ids=new set<id>();
    
    for(Investigation__c InvestigationObj : Trigger.new){
            ids.add(InvestigationObj.id)    
     }
    Investigation__c vi=[select id,Name from Investigation__c where id=:ids limit 1]; 
             Time_Entry_Recap_Report__c stc=new Time_Entry_Recap_Report__c();
             stc.Time_Entry_Recap_Report__c=vi.id;
      try{
            if(stc.size()>0){
             insert stc;
            }
     }
     
         catch(Exception e){
      //your Exception 
     }

Thanks,
Prashant
 
engrDaveengrDave 

I have searched the API docs and discussion boards and have not found any info about how to get to the SforceService or where it comes from, so I am starting a new post for this.

 

I am using VS2008, but target the .NET Compact Framework 2.0 for a CE 5.0 device. I generated a Partner WSDL (Which includes the SforceService endpoint def.). In VS2008, I added a Web Reference (not a WCF Service Reference!) and found the service description using the URL:

https://login.salesforce.com/?ec=302&startURL=%2Fservices%2Fwsdl%2Fclass%2FserviceName

(which looked successful).

 

I get the correct namespace added to my project with the proxy class for the service. When I try to set up the SOAP binding, I have no access to SforceService and cannot see it in the Object Browser. Is there something (i.e., an SDK) that I need to install to get this, or should it show up automatically from the service description while adding the Web Reference?

 

Please help! TIA, Dave

Best Answer chosen by Admin (Salesforce Developers) 
PaulAtInformzPaulAtInformz

I have been using the local WSDL file method. To get the local WSDL, I had to open the WSDL link and then view source. I copied everything there and pasted it into a text file and changed the extension to wsdl. Then in VS I added a web service reference and pointed it at file://c:\folder\path\to\file\wsdlFile.wsdl. That imported the whole thing correctly and you should then have access to the SoapClient. I'm sure smarter people than myself could tell you an easier way to do this, but that's what worked for me. 

Ram SRam S 
Hi All,
If any one finds difficulties in passing this challenge plz make changes in the VF page:
<apex:outputText value="{!sampleMergeField1}"/> <apex:outputText value="{!HTMLENCODE(sampleMergeField2)}" escape="false"/> <apex:outputText > {!sampleMergeField3} </apex:outputText> <script> document.write('{!JSINHTMLENCODE(sampleMergeField4)}'); </script> {!sampleMergeField5} <script> var x = '{!JSENCODE(sampleMergeField6)}'; </script> <apex:outputLabel value="{!HTMLENCODE(sampleMergeField7)}" escape="false"/>

Thanks,
Ram
Best Answer chosen by Ram S
Ram SRam S
<apex:outputText value="{!sampleMergeField1}"/> <apex:outputText value="{!HTMLENCODE(sampleMergeField2)}" escape="false"/> <apex:outputText > {!sampleMergeField3} </apex:outputText> <script> document.write('{!JSINHTMLENCODE(sampleMergeField4)}'); </script> {!sampleMergeField5} <script> var x = '{!JSENCODE(sampleMergeField6)}'; </script> <apex:outputLabel value="{!HTMLENCODE(sampleMergeField7)}" escape="false"/>
Turner GauTurner Gau 
Hi Gang,

Been trying all sorts of things to figure out anymore details for this error message that appears when I check the challenge on step 7, but coming up short.  Has anyone else experienced this error and any tips to resolve?

Challenge Not yet complete... here's what's wrong:
Ensure that the page works for existing Order records.

I have overridden both the New and Edit buttons/actions on the Order object.  My OrderExtension class appears to be working correctly in that I can successfully add new orders and edit them using the OrderEdit override vf page.  (The instructions specifically say not to edit that vf page so I have left it as is).  

In the log I see this is where it fails the check:
FATAL_ERROR AnonymousBlock: line 18, column 1
But unfortunately there are no real additional details that I see.

Any advice to resolve this or any tip to see more error information would be appreciated. 

Thanks!
Best Answer chosen by Turner Gau
Zachery EngmanZachery Engman
Verify your code works with the test it is doing, if not you will need to adjust to it.  It is very peticular:
Account testAccount = new Account();
testAccount.Name = 'test';
insert testAccount;
 
 orderExtension ext = new orderExtension(new apexPages.standardController(new Order()));
 ext.orderRecord.AccountId = testAccount.Id;
 ext.orderRecord.EffectiveDate = system.today();
 ext.orderRecord.Status = constants.DRAFT_ORDER_STATUS;
 ext.orderRecord.Pricebook2Id = constants.STANDARD_PRICEBOOK_ID;
 ext.orderItemList[0].Quantity = 1;
 ext.orderItemList[0].UnitPrice = 1;
 ext.orderItemList[1].Quantity = 2;
 ext.orderItemList[1].UnitPrice = 2;
 ext.save();
 
 List<Order> savedOrders = [SELECT Id, (SELECT Quantity, UnitPrice FROM OrderItems ORDER BY Quantity) FROM Order WHERE AccountId = :testAccount.Id];
 system.assert( savedOrders.size() == 1 );
 system.assert( savedOrders[0].OrderItems.size() == 2 );

 
Manoj Goswami 5Manoj Goswami 5 
Apex: 
<apex:page controller="allObjectListClass">
    <apex:pageBlock>
        <apex:form id = "myForm">
            
            <apex:pageBlockSection>
                <apex:selectList id="objList" value="{!selectedObj}" size="1">
                    <apex:selectOptions value="{!objName}"/>
                    <apex:actionSupport event="onchange" reRender="myForm"/>
                </apex:selectList>  
            </apex:pageBlockSection>
            
            <apex:pageBlockSection>
                <apex:pageblockTable value="{!fieldName}" var="f">
                    <apex:column value="{!f}"/>
                </apex:pageblockTable>
            </apex:pageBlockSection>
            
        </apex:form>        
    </apex:pageBlock>    
</apex:page>
Controller :
public class allObjectListClass {
    public String selectedObj {get;set;}
    
    public static List<selectOption> getObjName(){
        List<selectOption> options = new List<selectOption>();
        
        for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
        {
            Schema.DescribeSObjectResult objResult = o.getDescribe();           
            system.debug( 'Sobject API Name: ' + objResult.getName() +' Sobject Label Name: ' + objResult.getLabel());           
            options.add(new SelectOption(objResult.getName(),objResult.getLabel()));
        }
        return options;
    }
    
    public static List<String> getFieldName(){
        List<String> reqFields = new List<String>();
        /*
			Required Code 
		*/
        return reqFields;
    }
}
I am getting a hard time dealing with schema methods, i have gone through the Salesforce documentation though.
Thanks in advance...


 
Best Answer chosen by Manoj Goswami 5
Prashant Pandey07Prashant Pandey07
Hi Manoj,

You can execute below code..you will get all the required field from the object.

I made selectedObj as a static variable so that we can access in your static method. 

Please mark this as a best answer if you this class helps you to solve your problem


 
public class allObjectListClass {
public static String selectedObj{get;set;}

    public static List<selectOption> getObjName(){
  
       List<selectOption> options = new List<selectOption>();
        for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
        {
           Schema.DescribeSObjectResult objResult = o.getDescribe();           
           system.debug( 'Sobject API Name: ' + objResult.getName() +' Sobject Label Name: ' + objResult.getLabel());           
           options.add(new SelectOption(objResult.getName(),objResult.getLabel()));
         
        }
        return options;
    }

    
    public static List<String> getFieldName(){
     List<String> reqFields = new List<String>();
           if(selectedObj!=null){
        system.debug('^^^^^^'+selectedObj );
    
        Map <String,Schema.SObjectType> gd = Schema.getGlobalDescribe();
        Schema.SObjectType sobjType = gd.get(selectedObj);
        Schema.DescribeSObjectResult r = sobjType.getDescribe();
        Map<String, Schema.SObjectField> MapofField = r.fields.getMap();
                       for(String fieldName : MapofField.keySet()) {
                        Schema.SObjectField field = MapofField .get(fieldName);
                        Schema.DescribeFieldResult F = field.getDescribe();
        if( F.isCreateable() && !F.isNillable() && !F.isDefaultedOnCreate() )
        {
       reqFields.add(fieldName );
        }
       }

    }
    return reqFields;    
}

}


<!--************Visualfroce***********-->

<apex:page controller="allObjectListClass">
   <apex:pageBlock >
        <apex:form id="myForm">
            
            <apex:pageBlockSection >
                <apex:selectList id="objList" value="{!selectedObj}" size="1">
                    <apex:selectOptions value="{!objName}"/>
                    <apex:actionSupport event="onchange" reRender="myForm"/>
                </apex:selectList>  
            </apex:pageBlockSection>
            
            <apex:pageBlockSection >
                <apex:pageblockTable value="{!fieldName}" var="f">
                    <apex:column value="{!f}"/>
                </apex:pageblockTable>
            </apex:pageBlockSection>
            
        </apex:form>        
    </apex:pageBlock>   
</apex:page>