Questions tagged [sobject]
An sObject represents an object, such as an Account or Campaign. An sObject is the base object for all objects in Apex.
615
questions
1
vote
0
answers
306
views
RemoteAction: problem returning Map<object, sObject>
I am trying to return a map of object to sobject. However I get a parsing error:
VFRemote.js:117 Visualforce Remoting Exception: Error parsing json
response:
'Unexpected token {'. Logged ...
0
votes
1
answer
2k
views
Problem passing a list of sObjects from apex to JavaScript
In apex I retrieve a list of sObjects and store them in a list. So it looks like this: public static List<sObject> listOfSobjects {get;set;}
And then I query for this sobject from the db:
...
1
vote
1
answer
149
views
Problem populating a list of children related to a queried sObject
I have sObject1 called sObject1__c which is a parent(master-detail) to many sObjects2 each called sObject2__c.
So in my trigger I have an empty list of sObject2 related to sObject1:
sObject1__c....
3
votes
1
answer
1k
views
Is it possible to assign a field value as a key for a Map query
I am wondering if it's possible to create something similar to this:
Map<sObject.field, sObject> mapOfsObject = new Map<sObject.field, sObject> ([
SELECT field
FROM sObject
]);
I ...
6
votes
2
answers
775
views
Do email results come in the same order as the list of emails
I populate a list of emails emailsToBeSent and send them all at once. However These emails are related to different sObjects. And to me it is important to know which sObject the returned results are ...
2
votes
3
answers
2k
views
Iterate over queried lookup fields
Example:
Opportunity Opp = [SELECT Name, Status__c, Zone__c, Invoice__r.Amount__c, Invoice__r.Date__c FROM Opportunity WHERE ID ='006a12nlfoenlew'];
I need to iterate over each field and see if the ...
0
votes
0
answers
13
views
Query Resources in Resources [duplicate]
Is there any way I can query the Resources in Public Calendars and Resources? There does not seem to be any object related to the resources so if someone could help me out, it'd be great!
3
votes
2
answers
845
views
Remote Objects: Insert an array of objects
Is it possible to insert an array of objects using Remote Object Model?
Here's my code:
<apex:remoteObjects jsNamespace="romodel">
<apex:remoteObjectModel name="Stock__c" jsShorthand="...
0
votes
1
answer
2k
views
unable to convert parameter to apex type got arraylist [duplicate]
Is there a way to pass a sObject with RemoteAction from JavaScript to Apex?
I want to create a bunch of sObjects. What is the right way to pass their information from JS to Apex with RemoteAction?
...
3
votes
1
answer
891
views
Query for 'Lead' object is not returning a Converted Account ID
I am using the following JSforce command to get a specific lead:
jsobject('Lead').find({ Phone:number})...
The problem that I am running into is that I am getting data returned, but it seems to be ...
1
vote
1
answer
5k
views
Compatible Schema.DisplayType For SObject Put
I'm trying to write a method for working with sObject.put(field, value) statements in a loop where the Schema.DisplayType of the fields received varies.
The goal is to have the method return the name ...
0
votes
1
answer
64
views
N>Help with Passing Values from one Object picklist to another Object text
I have 3 objects Contact, mList and mEvent. mList is a junction object which has master-detail relationships to both Contact and mEvent. The mEvent has a picklist field called Group_Level__c (values 1,...
2
votes
3
answers
2k
views
Convert SObjects containing child/parent records into a map
How can the following list of records be serialized/deserialized into a map or collection?
Account[] accs = [select id, name, custom_parent__r.name, (select lastname, firstname from Contacts) from ...
3
votes
1
answer
404
views
repeat inputfields dynamic dependent on list of string
I have an sObject custom_obj__c with a multi-select picklist field items_list__c and its values (items) are (item1 list, item2 list, item3 list,..), and checkbox fields (item1_list__c, item2_list__c, ...
0
votes
4
answers
283
views
Displaying Related List on Custom Object: SObject row was retrieved via SOQL without querying the requested field
Any help would be greatly appreciated (either in actual code help or pointing me in the right direction).
I'm not much of a developer but was trying to get a related list from a custom object to ...
0
votes
1
answer
4k
views
Compile Error: Constructor not defined: [ApexPages.StandardController].<Constructor>(List<Partner__c>)
I'm trying to write an apex test class for my apex (extension) of my visualforce page which display list of partners from partner__c sObject and do some actions on its rows like edit and delete.
...
2
votes
1
answer
786
views
Get a deleted record using SObject Rows returns "The requested resource does not exist"
I'm using the SObject Rows API to get the fields values of a given record. It works fine on existing records but when used on deleted records it returns with an error of {"errorCode":"NOT_FOUND","...
0
votes
1
answer
2k
views
Dynamic SOQL for getting all objects in Salesforce Org
I am creating a VF page which contains a Picklist of all objects in my Salesforce org including Custom Objects. I am getting an error 'unexpected token: 'null' when I select custom object.
VF Page
...
14
votes
2
answers
1k
views
Case-Insensitive Maps?
How is it that describes seem to return case-insensitive maps? For instance, if I create a new custom setting, the following succeeds:
Map<String, SObjectField> fields1 = SObjectType....
1
vote
1
answer
681
views
How to update reference field in sobject
I'm trying to update a sobject (CollaborationGroupFeed) via apex, but I am unable to update a particular reference field (in this case: CreatedBy).
Here is my code:
CollaborationGroupFeed cgf = [...
1
vote
2
answers
1k
views
Dynamic formula field
How can i use dynamic field value in the formula field.
Like :- TEXT(contact__r.Contact_Title__c)
I want to deploy this formula field in my org without creating Contact_Title__c field on contact ...
0
votes
1
answer
659
views
Value an object with a map<String field, String value>
I am developing an apex code to scan an email and use some values i can found.
I have a custom object used to map the labels to existing fields.
Then i have a map with field names and values.
I would ...
2
votes
1
answer
279
views
MiddleName Field cannot find in in ".fields.getMap()"
We've just enabled the Middle Name and Suffix Fields feature and encountered the below issue.
SUMMERY : Just after enabling "Middle Name and Suffix Fields", Implementation of custom apex logic in a ...
0
votes
1
answer
3k
views
How to assign an Account Name on an Opportunity Test Class
I am creating a @testClass for an Apex Trigger I wrote with the intent to automatically set an Opportunity Checkbox field to False, if the Opportunity was cloned. (The Else statement also defaults the ...
4
votes
1
answer
1k
views
recalculateFormulas() causing UnexpectedException: Unable to create/update fields: IsDeleted
When I update my custom Record__c a trigger runs, and it calls recalculateFormulas() on the record. This results in the following error:
System.UnexpectedException: Unable to create/update fields: ...
1
vote
1
answer
290
views
What is the fastest way to update a field on thousands of records?
I need to create a new checkbox field on an SObject, and I would like the original value to be true. Setting the default value of the field to true only applies to new records.
What is the fastest ...
2
votes
1
answer
3k
views
Error: Read access denied for null
Does any one have any idea why I am getting this error
when I try to save {!sobj.c}
Error: Read access denied for null
my code
<apex:pageBlockTable value="{!sobjlst}" var="sobj">
&...
33
votes
1
answer
7k
views
Generic Apex Trigger
So I was kind of throwing round the idea of making a generic apex trigger that is callable by multiple objects. Say you have the following sObjects:
Account
Sales__c
Sales_Contacts__c
And I wanted ...
3
votes
2
answers
1k
views
Get all Button who have used JavaScript
Is there any way to find out all the Button in org who have used JavaScript in it.
Or
Lets make it more simple -
How can I get List of all Button in sObject. (Where also I can differentiate between ...
4
votes
1
answer
381
views
Can't find ForecastingItem sObject in DescribeGlobalResult
We recently upgraded to salesforce API v27 (from 21). Documentation says that there are some new objects added between v21 and v27. ForecastingItem object is one such object. But when I get all the ...
2
votes
1
answer
90
views
Is that possible to write dynamic code for Salesforce SOAP to use object like map?
For regular SObject, I can run the following code:
static void x(Map<String, String> fieldValuesMap) {
SObject so;
for (String key: fieldValuesMap.keySet() ) {
so.put( key, ...
2
votes
1
answer
660
views
How to use a Dynamic List Type of SObject getted by ID
I'm trying to do a Dynamic List of a SObject gutted from an ID.
My goal is SEND a SObject info via mail. (Opportunity, Case...)
From a list of selected records, I send by argument their IDs with ...
1
vote
1
answer
1k
views
How to add SObject to an SObject Collection in Visual Flow
I have a flow that loops through a few collections and eventually brings me to a point where I have assigned an SObject a set of variables. Then I want to add that SObject to a new collection for fast ...
0
votes
2
answers
293
views
Unit Test Fail - list has no rows for assignment to Sobject
Good Afternoon,
I am running my test class and i am getting the following error message.
Class.DM_MarketingCloudPolicyController.getPolicy: line 43, column 1
Class....
1
vote
1
answer
1k
views
How to check access of user for particular user on object
How do I check the access of current user on particular object dynamically.
I have a custom mapping object in that I am storing object name in the string.
I want to check Whether the current user has ...
2
votes
0
answers
159
views
Capitalization guidelines for Salesforce objects in managed package application UI
Can anyone suggest guidelines for how to capitalise references to Salesforce objects in a managed package application UI, in particular standard objects like Account, Contact etc.?
I've read the ...
1
vote
2
answers
898
views
Getting null value from standard getter method of sObject
I am stuck in a very strange situation. I have one custom object (test_Boolean__c) and a field of checkbox type (check_Boolean__c) whose default value is true.
Now this is what I did :-
Created a ...
0
votes
1
answer
468
views
Update a record to its default values[MetaData]
I want to refresh a record to the default values that we used while creating those fields ie in metadata. My object has around 100 fields, so manually searching and doing it is troublesome. I can use ...
9
votes
3
answers
5k
views
Is it possible to Upsert a List<SObject> with external ID specified
I'm getting an error when attempting to compile my Apex:
Upsert requires a concrete SObject type
In my code, I'm unable to create a concrete declaration for the container which I want to upsert. ...
0
votes
1
answer
908
views
Incompatible value type id for Map error
Anyone know why this keeps throwing an error?
list<Account>Dealerships = new list<Account>();
map<Id, OpportunityLineItem> Opp2Deal = new map<Id, OpportunityLineItem>();
...
-1
votes
1
answer
45
views
How to query another Objects field to get it's value
How do I query the value of Contact.Country__c? It is to be connected with Case.
For now my code is:
@isTest
public class WebToCaseCountryTest
{
public static testMethod void testTrigger()
{...
1
vote
0
answers
1k
views
How to clone record with its related list using custom clone list button in Sobject?
Clone record with its related list and update the picklist value
i have created one button on record top beside the clone button, when clicked, execute code that would make a new version record with ...
0
votes
2
answers
845
views
Using getSobject to fetch the parent Account of an Account
I would like to dynamically fetch the parent Account of an Account in a similar fashion to the way it's done in the selected answer to this question. However, this doesn't seem to work in this case. ...
6
votes
1
answer
10k
views
How to compare two sObjects from 2 List<Lead>()?
I'm in need of a way to see if changes were made to a reference of an object, and compare to the original values. This is independent of the trigger context variables such as oldMap + newMap.
Is ...
9
votes
4
answers
10k
views
How do I SOSL across objects, matching all records with FIND clause?
To all the expert SOSL gurus lurking out there, I thought this will be an interesting one:
I have some SObjects of different types and I want to return their Name values in a single query.
In ...
0
votes
1
answer
49
views
How to render a value to string which is coming from sObjcet Long Text area in saleforce Apex Class [closed]
I have a sObject which has a Long Text Area field "Account_Id" which contains , "'Account Name'+Account.name"
but when i want to replace "Account.name" value from my Apex class than i am failed.
e.g.
...
2
votes
1
answer
4k
views
List has No Rows for Assignment to SObject: Error
I have below trigger code where I get "List has No Rows for Assignment to SObject"
Apex trigger:
trigger CallVisibility on Compliance_Incident_Transaction_abv__c(before insert, before update) {
...
8
votes
6
answers
7k
views
Can you limit the visibility of fields based on record ownership?
I know with permission sets and sharing rules you can limit visibility and how users can interact with entire records. Is there any way to limit visibility of fields? We are looking to make the basic ...
1
vote
1
answer
240
views
Javascript query not finding existing field
There is some small work going on with a custom javascript button in an org that I do not have Admin access to. It fails on a field that clearly exists.
{!REQUIRESCRIPT("/soap/ajax/19.0/connection....
1
vote
1
answer
280
views
Attach Files to sObjects that don't offer standard support for it
I'd like to give users the ability to attach files to the Opportunity Product sObject which doesn't inherently support file attachments.
How do I add that ability?