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
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 ...
  • 4,621
3 votes
1 answer
398 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, ...
3 votes
1 answer
75 views

problem with sObject as parameter

I get the below error when I try saving CLASS 1 below. The second class that is the problem is also below. I obviously don't understand objects or apex well, so any help would be greatly appreciated. ...
  • 31
3 votes
1 answer
965 views

Fetching SObject Id from changes in Lookup fields using History tracking

I have set history tracking for my Custom Object and set a Lookup field for my referenced Object. CustomObjectX_c[Field1,Field2,Account_c] Here Account__c is a lookup field to the Salesforce ...
  • 2,406
3 votes
3 answers
3k views

SOAP API Request with body larger than 16 Kilobytes results in Timeout Exception

I stumbled upon an interesting limitation, it seems that SOAP API endpoint handles requests larger than 16Kb differently --- whenever body is larger than that request just times out. We're using '...
3 votes
1 answer
821 views

Possible to get sObjectName in Utility Bar LWC?

I'm creating a LWC that I want to have context from the currently focused tab. I want to have both the recordId and the sObjectName. In fact, I've successfully done this for the recordId based on this ...
  • 581
3 votes
2 answers
2k views

SOQL query for all Users who have read access to Task object

I am trying to write a SOQL query to find a list of Users who have read access to the standard Task object but my query keeps coming back empty. Is there a better way to do this? I have a dropdown ...
  • 273
3 votes
1 answer
66 views

SOSL on Permission Sets error when no ID is included

I am testing SOSL's on Permission Sets for something I am building and noticed that if I don't include the ID in the fields to request, the search fails: An unexpected error occurred. Please ...
  • 19.8k
3 votes
1 answer
266 views

Can a Web Tab's url be get and set from Apex or the REST Api?

I would like to modify the url of my Web Tab for each SF organization that my managed package is installed on. Is there a way to get and set the url of a Web Tab from Apex or the REST Api? Is there a ...
3 votes
1 answer
5k views

"New Action" vs "New Button or Link" for a custom object

A custom object's setup page has a section "Buttons, Links, and Actions". I've created buttons and links in the past, but do not remember the "action" option being there. Can anyone explain what "...
  • 133k
3 votes
1 answer
874 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 ...
3 votes
1 answer
50 views

Are SObjectField tokens safe in cross-managed package calls?

We have some code and SObjects and fields in a managed package that works when executed by other calls in that managed package as your would expect. The code looks like this. private SObjectField ...
  • 133k
3 votes
1 answer
310 views

Issues with a Query within the main Query using DatabaseDotcom Ruby gem

I'm having a issue with pulling the data out of what would be a array of object data in my SFDC query. Im using the databasedotcom gem. Code def self.data_query #@client is defined at a class ...
3 votes
1 answer
172 views

Insert sObject share for task that the user doesn't own

As a regular user (not system administrator) is it possible to create a share for a object that I'm not the owner of in APEX? Or will the DML statement throw an error?
3 votes
0 answers
365 views

How to check for/retrieve record-specific error message, e.g. by errors added through sObject.addError or validation rule?

I'm wondering about the documentation for the sObject class (API 50). It clearly states this for hasErrors(): Returns true if an SObject instance has associated errors. The error message can be ...
  • 982
3 votes
0 answers
831 views

Sobject Get on Relationship fields : Invalid Field [duplicate]

I am working on a module where I have to create complex nested JSON dynamically based upon configs stored in custom metadata, The metadata contains Object name, fields names as text fields. Now the ...
3 votes
1 answer
745 views

Aura Attribute of Type Object is Supported in Flows?

I am working on a Flow Screen and trying to assign a value to a lightning component attribute from a variable in the flow. The flow screen allows me to select the lightning component but it doesn't ...
3 votes
0 answers
92 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 ...
  • 14.7k
3 votes
1 answer
98 views

Change sObject field type and deploy using API

In this thread, there is a discussion about modifying a custom sObject's type. When I try to change the field's type in the Salesforce UI, I can see an error message with some references to the code. ...
3 votes
1 answer
2k views

Compile Error: sObject type 'Custom__c' is not supported in Managed Package

I'm creating an apex class that implements Schedulable and in the execute it queries a Custom Object but I can't understand why I'm getting this error when trying to query. Some other related ...
  • 2,082
2 votes
1 answer
770 views

How to loop trough second level deserializeUntyped Json String [duplicate]

PLEASE NOTE: deserializeUntyped not deserialize! I currently loop trough a jsonPayload which is working fine for the nodes of the first level.How can I achieve this for the node(s) of the second level ...
  • 2,274
2 votes
2 answers
2k views

Delete an SObject by knowing only Id

Is it possible to delete an SObject by knowing only Id? Here is what I found: Id del = '003S00000099999'; // whatever ID you are deleting Contact ct = new Contact(Id = del); delete ct; So, is it ...
  • 1,105
2 votes
1 answer
6k views

Create one table of multiple object types

I am looking to create a table, for instance pageBlockTable, with entries from multiple object types. The various objects share some fields, and also have unique fields. The table should display a set ...
2 votes
3 answers
5k views

System.QueryException: List has no rows for assignment to SObject

following apex code public String getLastUpdatedAt() { String timeStr; DatadoctorStatus__c last = [SELECT LastUpdated__c FROM DatadoctorStatus__c ORDER BY LastUpdated__c DESC LIMIT 1]; if (last == ...
2 votes
3 answers
1k views

Considerations for Map Keys with Trigger.new records in Before Insert Context

I have a scenario where, on insert of Events (Activities), I need to insert records related to the Events, and then tie them back to the Event by populating a custom field on the Event object with the ...
2 votes
3 answers
896 views

Can't set property value for SObject using setType function

I'll get my excuses in early: I'm a developer with some experience of working with APIs, but this is my first encounter with Salesforce. We've been given a spec to interface with a customer's ...
  • 123
2 votes
1 answer
2k views

Limitation on using getPopulatedFieldsAsMap method

I am excited to getPopulatedFieldsAsMap that being released on Summer 16 . I tried to run query however some of field does not return value. I thought it was bug but somehow it should be fixed in ...
  • 2,502
2 votes
3 answers
5k views

Retrieve object type via id using apex

I am new to Salesforce and trying to figure out the object type using the ID which I see in the URL on the Salesforce page. I found many places describing how to do this with the Apex language, such ...
2 votes
1 answer
54 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 ...
2 votes
1 answer
2k 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: ...
  • 391
2 votes
1 answer
1k views

Date Json.serialize removes 00:00:00 digits from datefields of object

I have the following object (invMappingNew): {customerId__c=1, addressId__c=8212BJ154, invoiceType__c=AdvancePayment, invoiceTypeLocalized__c=Voorschot, invoiceDate__c=2015-02-13 00:00:00, ...
  • 2,274
2 votes
2 answers
91 views

Embedded VF Page Not Responding To StandardController

I am trying to embed a custom VF page into my Accounts layout. I believe my error is in the standardController. I assumed it should be SObject but it did not work and now I am not 100% sure what it ...
  • 3,329
2 votes
3 answers
196 views

Invalid field for SObject using nested SOQL Query

Trying to create a list of Open activities so that I can sort and display as an apexDataTable on a VF page. I'm currently seeing the error: Invalid field Subject for SObject Account VF Page ...
  • 25
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) { ...
  • 2,910
2 votes
1 answer
2k views

How to give an object's all fields visibility to all profiles

I have an object which has around 100 fields now need to give all fields visibility to all the profiles. One possible solution is to edit each field and give its visibility to all profile but if i ...
  • 5,250
2 votes
1 answer
595 views

Can standard field "Name" for sObject be longer than 80 Characters?

Question is the title of this question...or do I have to use a custom field?
2 votes
1 answer
3k views

Retrieve SObject using Schema SObjectType class

I am trying to create a dynamic class to retrieve a record for update. I struggle with the following part of the code: targetSObject = new sor.getSObjectType()(ID = sObjectID); For example, if this ...
2 votes
1 answer
61 views

How can I abstract building maps from SObject Lists in a good way? [duplicate]

I frequently find I want/need to map a list of SObjects by a value other than it's own Id. So, I'd like to abstract this process to make it reusable. For example, I might want to map Contacts by ...
2 votes
1 answer
157 views

Which sobject stores the FieldPermissions for a profile.?

For a ProfileSet I see that field permissions are stored in the FieldPermissions sobject. Does anyone know which sobjects stores the FieldPermissions for a Profile? Thanks in advance
2 votes
1 answer
157 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 ...
  • 14.7k
2 votes
2 answers
1k 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 ...
  • 777
2 votes
2 answers
441 views

Show reports from a report folder in picklist

I currently have a text field on a custom object which is supposed to store a report URL. As things are right now, the user can simply paste the URL of a report and it gets saved. However, I want ...
2 votes
1 answer
747 views

How to create object by it's name?

I'm writing a REST service which calls external service. I want to write a test for my service. I came up with no possibility to mock this call as it's in managed package. I want to wrap this call ...
2 votes
1 answer
215 views

Is it possible to get valuetypes of fields of a JSON object without using getGlobalDescribe() [duplicate]

I have the following piece of code to get the valuetype. Is it possible to do this with getSObjectType() instead of getGlobalDescribe() since this is a lot slower. Apex Map<String, Object> ...
  • 2,274
2 votes
1 answer
256 views

Attempt to de-reference a null object when using alternative to getGlobalDescribe

In the following code String myString = 'Account'; SObjectType sObjType = ((SObject) Type.forName(myString).newInstance()).getSObjectType(); When myString = a object name does not exist i get a ...
  • 71
2 votes
1 answer
2k views

INVALID_TYPE: sObject type 'InstalledSubscriberPackage' is not supported

I'm querying the tooling API via some external C# code to get a list of installed packages. SELECT SubscriberPackage.Name, SubscriberPackage.NamespacePrefix, SubscriberPackageVersionId FROM ...
  • 106
2 votes
1 answer
5k views

Convert Schema.SObjectfield to string

I have a List of Schema.SObjectfield and I want to convert it to String. I am getting below error. System.JSONException: Apex Type unsupported in JSON: Schema.SObjectField Here is my approach. ...
  • 2,910
2 votes
1 answer
294 views

Unexpected difference using List<sObject> vs using Set<sObject> [duplicate]

I have sets of objects CustomObjectA, CustomObjectB, CustomObjectC... that I need to pass to a method. I would like to put them in a Map of type Map< String, Set< sObject > >, but when I ...
  • 454
2 votes
1 answer
1k 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 ...
2 votes
1 answer
667 views

Nested map without SObject

I'm using a nested map to store inputs from a Visualforce page and when I try to write the code to retrieve those inputs, I am getting "Error: Compile Error: Initial term of field expression must be a ...
  • 946

1 2 3
4
5
13