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.

Filter by
Sorted by
Tagged with
0
votes
2answers
494 views

Get default field value on vf page

I am trying to get the default value of field but an error is coming. List<String>apiNames = new list<String>(); for(string apiName : des.fields.getMap().keySet()){ apiNames.add(...
1
vote
2answers
287 views

How to get sObject from URL

How can I get the SObject from a url? Sample url: https://customcomp--dev.lightning.force.com/one/one.app#/sObject/a044B000001koVmQAI/view?a:t=1490977419216
0
votes
1answer
4k views

Schema.getGlobalDescribe() get ObjectType Describe

I'm trying to get the DescribeSObjectResult by writing the following code: public String fObjectName {get;set;} fObjectName = (String)Apexpages.currentPage().getParameters().get('objname'); ...
6
votes
2answers
2k views

How to create nested JSON object from custom sObject?

I am trying to create some config for front end based on config objects. I have one custom object where I specify options that I need. Each option is separate custom object of this type. I want to ...
0
votes
1answer
442 views

Vague error message - duplicates value on record with id

It's vague error message and I have already spent several hours trying to find out what I'm doing but could not able to find the cause I'm trying to do SObject.clone and I'm not preserving the Id here ...
0
votes
1answer
704 views

KnowledgeableUser does not support search

Using SOSL I did the following Query: FIND {name} in NAME FIELDS Returning KnowledgeableUser(ID) Console returns the following: entity type KnowledgeableUser does not support search It looks ...
1
vote
1answer
1k views

Create Customize cloning , copying old to new record

UPDATE: AFter I have tried with the @Adrian approach I'm getting the following error now: |EXCEPTION_THROWN|[65]|System.DmlException: Insert failed. First exception on row 0; first error: ...
2
votes
2answers
8k views

Setting field values generic SObject

Is there a way to instantiate an SObject? I have done the following: Id objId = 'a0Ci000000vd7xA'; String objName = ((Id)objId).getSobjectType().getDescribe().getName(); Type t = Type....
3
votes
2answers
379 views

How does SObjectType.newSObject() works?

From the documentation > SObjectType Class I see that we can instantiate a new sObject from the SObjectType class Could you tell me how does the code below create a new Account regarding the required ...
0
votes
0answers
99 views

How to map name value pair in custom fields to object field name and set the value as field value?

I have a custom object X that stores name value pairs. I need to populate a custom object Y which has field names same as the name part of the value. Through visual flow I need to query object X to ...
1
vote
4answers
587 views

Display sObject fields on Visualforce

I want to display Fields, e.g. Name, OwnerId, CreatedById, CreatedDate, LastModifiedId, LastModifiedDate of an sObject on Visualforce. The sObject is selected on the Visualforce page and then passed ...
0
votes
1answer
1k views

assign queue object to object.owner with Apex

Hi note I am new to Apex / Salesforce. Run down is at a specific instance I wish to create a new object but I wish to assign the Owner to a custom Queue I have prepared. Probably a simple fix just ...
2
votes
1answer
320 views

SELECT ActivityHistories For Any SObject

I am writing a code which supposed to process a list of ActivityHistories for any SObject which supports them (like Opportunity, Account, etc). And at that point it's impossible to know what is the ...
1
vote
0answers
26 views

How can we add the master record type in the pick list of record type, After creating different record types for account?

When we made different record types of an object, how can we add master record type in pick list also? In pick list option, all custom record type other than master record type are shown.
4
votes
1answer
609 views

setType & setField methods not available in SObject - Apex SOAP API

I'm trying to create an object of SObject class and then setting its type to Lead and setting one of the fields for Email. Eventually, I want to pass this object in findDuplicates() method. But the ...
1
vote
1answer
69 views

Why cant i get the field nodeId from account

I have this object from which i can get the name by:ATN[i].account.Name if i use ATN[i].account.nodeId i I get the error: Invalid field nodeId for SObject Account, the object is (ObjectStructureMap:[...
1
vote
1answer
118 views

Invalid field ContactPhone on SObject under Case Visualforce Page

I have a Visualforce page which has a Case object. It's pretty standard. However when I try to refer the ContactPhone by the code, using <apex:outputText value=" {!Case.ContactPhone}"></apex:...
0
votes
1answer
35 views

retrieve other fields of a SObject after a user has selected an option

I am writing an app that will help calculate the statute of limitations for certain laws. ex. enter a date that a crime happened on and, after choosing a law and appropriate limitation the limitation ...
3
votes
1answer
4k views

Invalid Field For SObject Error

I am having issues creating a table of related record for a custom object. I have a custom object 'Equipment Library' with a child custom object 'Equipment Library Item' which in turn had a field ...
1
vote
1answer
594 views

Prevent CRUD Delete/Insert/Update Checkmarx Issue for SObject in Apex Code

I am using Database methods for DML on SObjects. I am getting CRUD Delete issue in CheckMarx security scanner for below line: public SObject toDML; Database.delete(toDML, false); Can anyone help ...
0
votes
1answer
86 views

How do I specify the sObject type when working with specific fields in a cast collection of sObjects

I had to transfer a bunch of records from one user to another today. I decided to use the dev console because I needed it done quickly. I wanted to write generic code using sObjects but couldn't work ...
4
votes
2answers
8k views

What is the object that stores “files”

Which object stores the files (not attachments)? I'm looking to access this via a trigger. Is it possible to add a field to this document/file objects?
0
votes
3answers
133 views

Salesforce database : how does it work

I don't really know how to ask that question, in Salesforce we have objects, and if I want to update some object (for example) I use an soql query like Account a = [select name from Account where id ...
1
vote
3answers
362 views

Didn't understand relationship error - Similar relationships, different behaviours

We have two objects which has lookups to Account object. Objects are as follows Issue (audit_breach__c) - R/S name Issues Audit (audit__c). - R/S name Audits Were trying to do the following SOQL on ...
6
votes
1answer
1k views

Unable to read SObject error in Lightning Component when record has been queried from the database

I had encountered the "Unable to read SObject" error when attempting to pass an SObject record from Lightning to an @AuraEnabled Apex method. Based on this question, I first tried setting the "...
0
votes
1answer
539 views

How to assign Sobject list into String

Hi I am having an Sobject list. While iterating through the Sobject list using FOR loop, I can only able to get the Id not all the fields of the Sobject. Can someone please help me to solve the issue. ...
3
votes
1answer
344 views

How to use a Fieldset with an arbitrary sObject in Visualforce?

Working from the fieldsets section of the Visualforce Developer's Guide, I can build a table based on a fieldset for a given sObject type, for example (error handling elided for clarity): // ...
1
vote
2answers
49 views

Many-to-Many schema design

We are soon to implement a solution where people (Person__c) can delegate jobs to other people, and which jobs depend upon a person's Role. (Role__c). The role of a person depends on the delegation ...
2
votes
1answer
275 views

Salesforce Objects that do not have Id as the unique identifier

I just observed that a Salesforce Object called ApexPageInfo has duplicate Ids. The assumption was that Ids are unique. However, prodding through the describessObject of the object, the field ...
2
votes
1answer
1k views

Using ObjectType global variable in lightning component

In the doc (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_dynamic_vf_globals_objecttype.htm) it is said that the SobjectType global variable can be used in lightning ...
3
votes
2answers
714 views

SOQL Query to get Accounts that have been refreshed since x time

I have a connected app that will pull data from a salesforce Object. In order to do so, am executing the following query (and sending it through the REST API as form-url-encoded): SELECT Name,Id,...
1
vote
2answers
966 views

Dynamic Apex SObject Iteration

I've been trying for many hours to find the correct syntax in the documentation and via other searches in Google to get some dynamic code to run. Hopefully someone here will be able to provide the ...
3
votes
2answers
5k views

List<SObject> Cast to List Concrete type

I have a List<sObject> scope and I want to cast it to a concrete type: List<My_Concrete_Type__c> I tried scope.getSobjects('My_Concrete_Type__c') but this doesn't compile. How can I get ...
0
votes
1answer
1k views

Add to a cart : create and populate a custom object in apex

In a lightning component, I want that when I click a button, it create a new custom object (a virtual cart) and populate it with the select item. I have 3 custom object: the articles__c, the ...
5
votes
1answer
6k views

Clone list of SObject records using deepClone() to clone all the fields on records

I am trying to clone the records of a custom object. I know that I can use the deepClone() method of the List class to do this. List<MyCustomObject__c> originalList = [Select Id, Name, Age From ...
4
votes
2answers
51 views

Incorrectly Typed List - No Runtime Exception?

Grouping records is a pretty common pattern, enough so to write a simple library for it. Something like: public class GroupBy { public Map<Id, List<SObject>> ids(SObjectField field, ...
0
votes
2answers
773 views

Adding VF page to an Object's related list in the page layout

We can add VF pages to an Object's page layout. But when we add any visualforce page to the layout then we are only restricted to add only between the EDIT & DELETE buttons of the object layout. ...
1
vote
2answers
2k views

Query name/Help Text/Description of custom fields in a custom object

I want to Query Name/Help Text/Description of custom fields in a custom object. Something like: SELECT Name, HelpText, Description FROM sboject WHERE object = XXX
0
votes
1answer
46 views

Trigger Calculation between two fields from different sObjects

I am new to apex. I have two objects blood_bank__c and patient__c. I want to change quantity of blood in blood bank after patient is given some blood. This trigger is not working, and its not allowing ...
2
votes
1answer
106 views

Standard SObject which are not exposed by Salesforce

I would like to know if there is Standard SObject for Changeset or Package? I noticed that 033 is prefix for Package and 0A2 is key prefix for Changeset. However, neither of there objects are not ...
0
votes
2answers
291 views

Unable to create copy Case owner look up field onto a custom lookup field

Is there any possibility to create the custom field like case owner of standard field.
0
votes
1answer
2k views

Check is SObject has certain field

I hope you'll help me to solve my problem :) I've write class that check is sobject has a field of a certain name public static boolean hasSObjectField(String fieldName, SObject so){ return so....
1
vote
1answer
285 views

How to find External ID of contact sobject?

I am looking into doing a web-to-lead integration with a Drupal website. As I understand it, to push data to a salesforce sobject I need to identify the relevant fields in Salesforce which are being ...
0
votes
1answer
337 views

Deploying Entire Project getting “Cannot create workflow directly” Related to Reply and Question Sobjects

I'm using Sublime with Mavensmate to deploy an existing project to my SF dev org. Upon deploying I get the following errors. Reply.workflow: Cannot create workflow directly; must create the ...
9
votes
2answers
813 views

Strange Behavior with null sObject in Apex Class

I've observed some strange behavior with null sObjects which are members of an Apex class. Consider the following anonymous block: public class test { public Contact tc; public test(){} } ...
11
votes
2answers
554 views

Null record Date field displays todays date

I have a VF page where I am rendering out some subscription information and a couple of the fields are date fields. The issue (sort of) I am seeing is when a record is null and the VF markup calls a ...
2
votes
2answers
422 views

Sobject put set value of managed field in case of same field api name as unmanaged field

We are developing a managed package that contains a custom object and a REST API to do CRUD operation on that object. We are not using standard salesforce REST API for valid business reasons. In this ...
2
votes
1answer
49 views

Trigger on Single Field

I was playing around with Apex Triggers and was wondering, suppose I had an object (for example Account), which contains a sub-object (such as the string BillingAddress). Can I set a trigger on ...
3
votes
0answers
78 views

Does List<SObject>.sort method implementation depend on version?

I believe that I have found very interested undocumented bug in Salesforce. I don't see in the documentation saying that List.sort method implementation depends on version, but looks like it does. If ...
0
votes
1answer
1k views

How to check that SObject field is present in SOQL query

When you try to attempt to the field that not present in SOQL query, you get error like that: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: ...

1
3 4
5
6 7
10