• BoonPlus
  • NEWBIE
  • 35 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_system_remoteobjectcontroller.htm

RemoteObjectController
Use RemoteObjectController to access the standard Visualforce Remote Objects operations in your Remote Objects override methods.

RemoteObjectController Methods
The following are methods for RemoteObjectController. All methods are static.
create(type, fields) Create a record in the database.
del(type, recordIds) Delete records from the database.
retrieve(type, fields, criteria) Retrieve records from the database.
updat(type, recordIds, fields) Update records in the database.

retrieve(type, fields, criteria)
Retrieve records from the database.
Signature
public static Map<String,Object> retrieve(String type, List<String> fields, Map<String,Object> criteria)
Parameters
type
Type: String
The sObject type on which retrieve is being called.
fields
Type: List<String>
The fields to retrieve for each record.
criteria
Type: Map<String,Object>
The criteria to use when performing the query.


My question is: How do set the criteria like 'where' and 'orderby' (in the java script below) in the retrieve method for RemoteObjectController
<apex:remoteObjectsjsNamespace="RemoteObjectModel">    
    <apex:remoteObjectModel name="Contact" fields="FirstName,LastName"/>  
</apex:remoteObjects>

<script>
var ct = new RemoteObjectModel.Contact();
ct.retrieve( 
    { where: { 
        FirstName: {eq: 'Marc'}, 
        LastName: {eq: 'Benioff'} 
      }, 
      orderby: [ {LastName: 'ASC'}, {FirstName: 'ASC'} ],
      limit: 1 },  

    function(err, records) { 
        if (err) { 
            alert(err); 
        } else { 
            console.log(records.length); 
            console.log(records[0]); 
        } 
    } 
);
</script>
 
public class TestRemoteActionOverrideController{
    @RemoteAction
    public static Map<String,Object> retrieve(String type, List<String> fields, Map<String, Object> criteria) {
        fields.add('Name');

        //
        // place holder for converting criteria below in java script to apex
        //
        // { where: { 
        // FirstName: {eq: 'Marc'}, 
        // LastName: {eq: 'Benioff'} 
        // }, 
        // orderby: [ {LastName: 'ASC'}, {FirstName: 'ASC'} ],
        // limit: 1 }
        
        // call through to the default remote object controller with our modified field list.
        return RemoteObjectController.retrieve(type, fields, criteria);
    }
}

 
I have a price book entry field set and I wanted to add it as a component to my package, for some reasons, it's not showing up in the "Add To Package" view with the Component type set to "Field Set". Any idea why?
I signed up a partner developer editon just now, and the first thing I did after I logged into this new org was to create a simple "HelloWorld" VF page ...
<apex:page >
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Hello World</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>

After I clicked on the "Preview" button, the URL in the borwser first showed "https://na17.salesforce.com/apex/HelloWorld" then it got immediatedly changed to "https://c.na17.visual.force.com/visualforce/recsession?sid=00Do0000000KCZ9%21AQYAQCEqUDGvlEz9kvuEQ4LyI6RQXlxqEOWOOAVcCniuBtIkP3cfmcY4IH0qz2Ee.vcLJ3KLNPUUl0bgbYzQzsJXf.wiaOpb&inst=o&cshc=0000000qCMx0000000KCZ9&retURL=https%3A%2F%2Fc.na17.visual.force.com%2Fapex%2FHelloWorld"

which took me to a blank page.

I've tried to clear the browser cache and used a few different browsers to bring up this simple vf page, the end result was the same. Not sure what happened, please help. 

I received the error below if the Field is set to 'Name' or 'ProductCode'.

Unknown property '$ObjectType.OpportunityLineItem.fields.Name'
Error is in expression '{!$ObjectType.OpportunityLineItem.Fields['Name'].label}' in component <apex:outputLabel> in page olifspage
Error evaluating dynamic reference 'Name'

<apex:page >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:outputLabel value="{!$ObjectType.OpportunityLineItem.Fields['Name'].label}"/>          
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>		       	
</apex:page>
But the page worked fine if  the Field is set to 'ListPrice' or 'Description'. I did the DrescibeFieldResult and compared the porperty of these fields ...
Map<String, Schema.SObjectField> M = Schema.SObjectType.OpportunityLineItem.fields.getMap();
for(String s:M.KeySet()) {
    if (s=='Name' || s=='ListPrice'||s=='ProductCode'||s=='Description') {
    	Schema.DescribeFieldResult F = M.get(s).getDescribe();
        system.debug(F);
    }
}
I could not figure out if there's a field properity that can tell me if a field can be used in my VF page without getting the error. Any Suggestions?

Could someone help me out with a packaging problem that I am having?

I have created a base package (managed) and installed it in a DE org. then I used the components (i.e. fields, VF page, Apex Class) from the base pkg and developed an extension package.  For some reasons, I don't see any base package components got added to the extension package after the upload.

When I installed my extension package, I received the error below 

Package install error
There are problems that prevent this package from being installed.
A required package is missing        
Package "base", Version 1.2 or later must be installed first.

any idea how I can resolve this problem?

Paul
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_system_remoteobjectcontroller.htm

RemoteObjectController
Use RemoteObjectController to access the standard Visualforce Remote Objects operations in your Remote Objects override methods.

RemoteObjectController Methods
The following are methods for RemoteObjectController. All methods are static.
create(type, fields) Create a record in the database.
del(type, recordIds) Delete records from the database.
retrieve(type, fields, criteria) Retrieve records from the database.
updat(type, recordIds, fields) Update records in the database.

retrieve(type, fields, criteria)
Retrieve records from the database.
Signature
public static Map<String,Object> retrieve(String type, List<String> fields, Map<String,Object> criteria)
Parameters
type
Type: String
The sObject type on which retrieve is being called.
fields
Type: List<String>
The fields to retrieve for each record.
criteria
Type: Map<String,Object>
The criteria to use when performing the query.


My question is: How do set the criteria like 'where' and 'orderby' (in the java script below) in the retrieve method for RemoteObjectController
<apex:remoteObjectsjsNamespace="RemoteObjectModel">    
    <apex:remoteObjectModel name="Contact" fields="FirstName,LastName"/>  
</apex:remoteObjects>

<script>
var ct = new RemoteObjectModel.Contact();
ct.retrieve( 
    { where: { 
        FirstName: {eq: 'Marc'}, 
        LastName: {eq: 'Benioff'} 
      }, 
      orderby: [ {LastName: 'ASC'}, {FirstName: 'ASC'} ],
      limit: 1 },  

    function(err, records) { 
        if (err) { 
            alert(err); 
        } else { 
            console.log(records.length); 
            console.log(records[0]); 
        } 
    } 
);
</script>
 
public class TestRemoteActionOverrideController{
    @RemoteAction
    public static Map<String,Object> retrieve(String type, List<String> fields, Map<String, Object> criteria) {
        fields.add('Name');

        //
        // place holder for converting criteria below in java script to apex
        //
        // { where: { 
        // FirstName: {eq: 'Marc'}, 
        // LastName: {eq: 'Benioff'} 
        // }, 
        // orderby: [ {LastName: 'ASC'}, {FirstName: 'ASC'} ],
        // limit: 1 }
        
        // call through to the default remote object controller with our modified field list.
        return RemoteObjectController.retrieve(type, fields, criteria);
    }
}

 
In Winter '17 we are able to include in a managed pacakge a "Lightning App" that pre-defines tabs to include.  From the Lightning App Manager in a subscriber org (where the package is installed) if we edit the app it allows us to remove "Selected Items", but when we go to save the changes we receive the following error:

An error occurred while trying to update the record. Please try again. Cannot modify managed object: entity=TabSetMember, component=null, state=MANAGED_INSTALLED - tab

Is this a platform bug or simply, a limitation, or not yet a supported action?

Thanks,
Ross
Is there a way to automatically sort Opportunity Products?  By default, SFDC sorts Oppty product by name (alphabetically).  If i create a number field and populate each Pricebook Entry with the sort order number, can a trigger use that field to sort the Oppty products?   

If someone can share a code, i would greatly appreciate it.  This limitation is a pain in the butt. 
  • October 23, 2014
  • Like
  • 0
I have a price book entry field set and I wanted to add it as a component to my package, for some reasons, it's not showing up in the "Add To Package" view with the Component type set to "Field Set". Any idea why?
I signed up a partner developer editon just now, and the first thing I did after I logged into this new org was to create a simple "HelloWorld" VF page ...
<apex:page >
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Hello World</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>

After I clicked on the "Preview" button, the URL in the borwser first showed "https://na17.salesforce.com/apex/HelloWorld" then it got immediatedly changed to "https://c.na17.visual.force.com/visualforce/recsession?sid=00Do0000000KCZ9%21AQYAQCEqUDGvlEz9kvuEQ4LyI6RQXlxqEOWOOAVcCniuBtIkP3cfmcY4IH0qz2Ee.vcLJ3KLNPUUl0bgbYzQzsJXf.wiaOpb&inst=o&cshc=0000000qCMx0000000KCZ9&retURL=https%3A%2F%2Fc.na17.visual.force.com%2Fapex%2FHelloWorld"

which took me to a blank page.

I've tried to clear the browser cache and used a few different browsers to bring up this simple vf page, the end result was the same. Not sure what happened, please help. 

Hi everybody,

 

I'm facing the following problem: my sandbox environment doesn' show up the code coverage column on Apex-Classes list after running all tests or just some particular Test Classes. And when I click Estimate your organization's code coverage it shows 0% of code coverage but there must be some code coverage. In fact I'm currently not able to evaluate the overall code coverage.

 

Can anyone give me a hint on what i'm missing or to look at?

 

Thanks in advance.

  • September 22, 2013
  • Like
  • 0

I am trying to write a trigger to chang the quotelineitem's sort order by copying the item number, which is a custom field. I am recieving the following error:

 

Compile Error: Field is not writeable: QuoteLineItem.SortOrder

 

Here is my code:

trigger LineItemSortOrder on QuoteLineItem (Before Insert, Before Update) {
    
    QuoteLineItem[] q = trigger.new;

   for (integer i = 0; i < q.size(); i++) {
      QuoteLineItem nquote = q[i];
      nquote.sortorder = integer.valueof(nquote.Item__c);
  
   }    
    
}

 

Is there any way around this error?

 

Thank you,

ckellie

Hi Thee, was wondering if someone could help me out with a packaging problem I am having...

 

I have created a base application, which has a limited set of functionality.  Additionally i have developed extension package the completed the application.  This is so we can have our application installed in GE/PE orgs, whilst offering a more comprehensive application to DE/UE/EE customers.

 

I have everything setup, packaged, unit tested etc... The install procedure works fine if I install the base package first then the extension, but it someone wants to install the full version straight away the following happens;

 

Package install error

There are problems that prevent this package from being installed.

A required package is missing         
Package "base xxx", Version 1.2 or later must be installed first.

 

Is there a way round this, or will I have to have every customer install both packages?  Would be a shame not to have a Get it Now button on my AppExchange listing because of this!

 

Cheers

 

Chris

 

I'd like to re-open the discussion of SortOrder on the OpportunityLineItem object. A thread from 3.5 years ago can be located here:
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=3154

Looks like people from SF were going to look into it but obviously nothing has come to fruition. The reason I have put this in the Visualforce board is that we have have a few VF applications that could really take advantage of access to this field. Visualforce has also opened up new possibilities to UI design where the ability to manage SortOrder could be useful.

Also, no offense to salesforce.com, but the tool for sorting OpportunityLineItems is not that useful when there are multiple products with the same name. I have actually built a pretty slick sorting application but this is currently useless.

A lot of the concerns were about error handling. What happens if you have 3 line items but sort order is defined as, 1, 2, 2. Or 1, 2, 4. How about just throwing a sortOrder exception and force the developers to write good code?

Ideas? Thoughts?
http://ideas.salesforce.com/article/show/10092062/OpportunityLineItem_SortOrder_to_be_CreatableUpdatable

-Jason


Message Edited by TehNrd on 09-05-2008 01:22 PM
  • September 03, 2008
  • Like
  • 1