Questions tagged [schema]

Schema is a tag used to describe questions related to the dynamic processing of the system schema through the various describe methods.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

How to retrieve reference field's value dynamically

sObject record = Database.query(query); // current record values Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); Schema.SObjectType objSchema = schemaMap.get(objName); ...
user avatar
  • 23
1 vote
1 answer
60 views

Getting error for user fields in LWC component when using schema?

I am trying to retrive field information for user fields using following code. But except for the Name field of User, it is throwing error for every other field. Any idea why its not letting me access ...
user avatar
0 votes
1 answer
17 views

Finding fields for standard data types

I've been trying to complete a challenge on trailhead (link here) The text says "Create an Apex trigger that sets an account’s Shipping Postal Code to match the Billing Postal Code if the Match ...
user avatar
  • 3
1 vote
0 answers
20 views

How to get the Field Label from the Columns retrieved from the List view Metadata?

I have written an Metadata API from https://github.com/financialforcedev/apex-mdapi to get the List view details. Below is my code: MetadataService.MetadataPort service = MetadataServiceExamples....
user avatar
  • 31
0 votes
0 answers
27 views

Can't access RecordTypeId of Account object

I'm not sure why I can't access the RecordTypeId or any sort of recordtype field of the Account object. //error at select Account[] accs = [SELECT RecordTypeID, TYPE FROM Account]; Schema....
user avatar
  • 1
0 votes
1 answer
61 views

need to capture lastmodifiedBy user and date of LWC in salesforce

I have requirement where i need to fetch modified lwcComponent with the user who modified it programmatically. Is there any soql query we can use or by apex schema we can get it.Audit trail does not ...
user avatar
  • 1
4 votes
1 answer
85 views

Can a Number field in a managed package be changed to a Currency field of the same precision and scale?

Such a change can be made using sfdx force:source:push, presumably because there isn't any risk of data loss (mentioned in Notes on Changing Custom Field Types). Can this change be packaged and orgs ...
user avatar
  • 129k
0 votes
1 answer
259 views

(Schema.SObjectType) || Method does not exist or incorrect signature: void

I'm trying to list the Record Types that a user has access to. Unfortunately, this cannot be done through SOQL Query (IIRC) and the only choice I have would be to either use Schema.SObjectType (Apex) ...
user avatar
  • 103
0 votes
2 answers
68 views

Check field is updatable

I have object and field name, but don't understand how to check if that field isUpdatable. It gives me the error: Variable does not exist: fields SObjectType objectType = Schema.getGlobalDescribe()....
user avatar
6 votes
0 answers
98 views

APEX Schema ChildRelationships: why have some relationships their relationshipName = null?

There is some strangeness in the some standard Childrelationships. Most Relationships are as expected, but let us take Account and Quote as an example: On Quote we have a standard lookup field Quote....
user avatar
  • 33.5k
0 votes
1 answer
734 views

Get parent record fields using getRecord uiRecordApi in lwc

I'm trying to get parent record value using uiRecordApi in my lwc component. But I'm getting error. Cannot read property 'value' of undefined import OPPORTUNITY_ISCLOSED from '@salesforce/schema/...
user avatar
0 votes
1 answer
74 views

Retrieve the type of field using Schema classes

I am trying to create a generic class to retrieve the type of a field for any sObject. I am struggling with the following part of the code: String[] fields = ['Id','Name']; for(sObject o : ...
user avatar
0 votes
0 answers
107 views

How to access the value of Schema.sObjectField?

I am new to apex coding, Can anyone please help me here? I am working on after update trigger and I am using the below code to know what fields were updated. I got a code on StackExchange that serves ...
user avatar
0 votes
1 answer
47 views

Will a query from Organization ever return more than one row?

I'm curious. Is it possible for the query below to return more than one row? Do Divisions somehow create multiple Organization rows within an org? SELECT Id, Division FROM Organization
user avatar
  • 433
1 vote
2 answers
163 views

Dynamically get object info

I see so many examples like below; however, I want to be able to pass a string that holds 'Account' or custom object name for example. The examples I see on SF are hard coding Account. The reason I ...
user avatar
  • 23
0 votes
1 answer
101 views

How to get rid of Master Record Type on custom Record Type Lookup?

I created custom lookup with all possible Record Types to choose by user. I simply retreive List with Record Type Infos from Schema globalDescribe and pass it from apex controller to aura component. ...
user avatar
  • 635
0 votes
1 answer
33 views

DescribeSObjectResult cannot find field

Let's say we have a simple code Schema.DescribeSObjectResult res = Schema.SObjectType.Account; system.debug(Schema.SObjectType.Account.fields.Name.isAccessible()); system.debug(res.fields.Name....
user avatar
  • 687
0 votes
0 answers
110 views

How to query formula field and related object field values by Schema class

I have this below method when I am passing fields dynamically to get passed object records. relatedObjectName ==> Planner__c recId ==> RecordId of Planner__c fields = AccountPlanner__r.Email (...
user avatar
0 votes
1 answer
337 views

How to get a list of Field Set names in Apex [duplicate]

I need to create combobox with Field Set names. I know how to get fields for any Field Set, but how to get a list of all Field Set names. Map<String, Schema.FieldSet> canMap = Schema.SObjectType....
user avatar
-1 votes
1 answer
196 views

Get user's last assignment (or re-assignment) to profile or permission set datetime

Is it possible? Let's say we have a lot of users, profiles and permsets. There is need to get last datetime when user was assigned to particular permset or profile using SOQL. Which fields could help?
user avatar
  • 687
1 vote
0 answers
22 views

Customer 360 Audiences Web and Mobile Application JSON Schema

I have gone through the following documentation regarding creating an Event Type JSON schema for the mobile or web application connector in Customer 360 Audiences: https://help.salesforce.com/...
user avatar
0 votes
0 answers
115 views

How do I get the API specification or schema for a custom REST endpoint?

How do I get the API specification or schema for a custom REST endpoint? I'm looking for something basic, similar to the examples provided within this documentation for OpenAPI Specification. The end ...
user avatar
0 votes
1 answer
1k views

Deserialize a JSON to a List<SObject>

I have an Apex class which has a method having an Object type parameter public with sharing class DmlOnSObjectRecords { @AuraEnabled(cacheable=false) public static void dmlOperationOnSObjectRecords(...
user avatar
  • 1,071
1 vote
0 answers
97 views

Schema.describeTabs() returns empty DescribeTabSetResult

I have a piece of Apex code that does Schema.describeTabs() When i run this as System Administrator, i get the tabs back just fine. Some other users running this code get empty List<Schema....
user avatar
  • 1,566
0 votes
1 answer
71 views

Mysterious "Long" DisplayType

I'm trying to figure out what "Long" DisplayType is (it's listed in Schema.DisplayType Enum values). I've checked standard fields for a couple of SF standard objects but didn't find any ...
user avatar
0 votes
1 answer
128 views

filterable property in schema

how to get fields which are queryable(can be used in query) or filterable(property from schema) from an object like account without using soql queries. Any suggestions? how to achieve this.
user avatar
1 vote
1 answer
75 views

get count of all the fields containing data in a specific object

public static Map<String, decimal> getFieldsCount(String objectName){ Map<string,Schema.SObjectField> get_F_name=Schema.getGlobalDescribe().get(objectName).getDescribe()....
user avatar
2 votes
1 answer
258 views

Get list of all required fields of sObject dynamically in Salesforce

I want to build a list of fields marked required at the schema level. I have tried below snippet, It works great but fails for the field with default values. Map<String, Schema.SObjectType> m = ...
user avatar
0 votes
1 answer
491 views

get custom setting fields names in apex class

Requirement-I need to create a map of custom setting in apex class with fields and value like. "Name":"test", "cal__c":"tesq", "industry__c":"...
user avatar
1 vote
0 answers
66 views

No such field ActivityOriginType even though returned through field map

We have an all fields query that gets the field map from an object's describe in Apex. It then loops over the map and assembles a query. In one clients org, the field map is spitting out ...
user avatar
  • 2,319
1 vote
1 answer
918 views

LWC UI Object Info API get only particular Field Label

The lightning/uiObjectInfoApi module includes wire adapters to get object metadata and picklist values. getObjectInfo -> Can we fetch only metadata of particular field instead of whole object ...
user avatar
  • 127
3 votes
1 answer
4k views

LWC: Unable to fetch custom field through the schema

I have a LWC component in which I am trying to pull the metadata from the schema so I can use updateRecord. I've done this before for a different custom object(and it worked) but this time I am ...
user avatar
  • 4,441
1 vote
1 answer
80 views

How to pass the parameter to which an object needs to be cast to

I have the following piece of code where I wish to cast a certain object to a specific SObjectType. public static void someMethod(Object obj, Schema.DescribeSObjectResult objectType){ ... ...
user avatar
0 votes
1 answer
44 views

Capture States on Account where the Account is doing business

I am trying to establish relationship between Accounts of different Recordtypes Account: CustomerID = BYR1 , RecordType = Buyer, Located IN = OH Account: L1, RecordType = Lender , Doing Business In ...
user avatar
1 vote
0 answers
46 views

How to use DuplicateRecordSet field: SobjectType

According to the documentation, DuplicateRecordSet there is a field SobjectType, however, after running the following code in Execute Anonymous, it doesn't appear that this field exists... Map<...
user avatar
  • 1,258
-1 votes
1 answer
61 views

writing a program for Transferring ownership owner to owner for all objects

I'm writing a program for transferring ownership dynamically. But It has to work for all objects. Public Class TransferOwnership{ @AuraEnabled public static string tranferRecordOwnership(String obj,...
user avatar
0 votes
1 answer
531 views

How to get last created record date of all custom objects having total number of records greater than 1 lakh

My requirement as part of org analysis is to get list of all custom objects having more than 100000 records and created date of LAST CREATED record. My tries are as follows:- Go to Setup - Storage ...
user avatar
0 votes
1 answer
254 views

How to use a SOQL query for Sobjects like Passing Sobject as Variable inside the quey

I'm trying to write a SOQL query, But this query have to work for all object in one query. I want to use same query but I want to change object name dynamically public class Test { public static ...
user avatar
1 vote
0 answers
164 views

Avro schema (or Json) for SObject, Platform Events and SOQL queries

I would like to generate Schema for SObjects, Platform Events and SOQL so to be used in a typed programming language. I see it is possible to obtain the Avro schema for Platform Events here: https://...
user avatar
  • 1,612
0 votes
1 answer
83 views

Error with RequestsForAccessSIQ

Hi I am working in a migration of metadata from one org to another. I am having the following error related to an object called "RequestsForAccessSIQ". Invalid fullName, must end in a custom ...
user avatar
1 vote
0 answers
202 views

Schema.getGlobalDescribe not showing all standard object even from System Admin Profile

I am trying to run very simple code in a static method under classs. Method: public class TestUtil { public static void testMethod1() { for(String str : Schema.getGlobalDescribe().keyset()...
user avatar
-1 votes
1 answer
47 views

SOQL to schema converison

public static map<id,RecordType> MapRecordtype = new Map<id,RecordType>([SELECT id, DeveloperName FROM RecordType where sobjecttype ='move__c' and ...
user avatar
-2 votes
1 answer
63 views

How to convert Query to Schema [duplicate]

I want to obtain record type info like: List<RecordType> lstrecord = new List<RecordType>([Select id,Name from RecordType where sObjectType = 'Move__c' and Name = 'Draft' ]); using ...
user avatar
-1 votes
1 answer
55 views

How to only on field history enable object in apex?

We have 5 objects. In these objects, we are only tracking 3 objects field history, How can I query on enable history objects How how to get only field history enabled object Name Please help me in ...
user avatar
5 votes
1 answer
463 views

Get Schema of all sObjects in one Api Call, like Schema Builder

I am building a web tool to get the schema of a particular sObject, or an entire org, and save it as a Json file using the SalesForce Rest API. To do this, I am first getting a list of all the ...
user avatar
5 votes
1 answer
1k views

lwc getFieldValue from a custom external object

I am creating a LWC that handles data from an external object. I have access to the recordId through @api recordId;, but I need to get the externalId from this object as well. Currently, I have call ...
user avatar
  • 83
0 votes
2 answers
402 views

How to use a Schema.SObjectType as a variable to instantiate a set?

I am trying to create a class that can take in multiple different objects(one at a time), and work from there with the data it is passed in. Code is as follows: public static void createCharges(List&...
user avatar
0 votes
1 answer
161 views

How to get hierarchy of all objects dynamically through schema code

How to get a hierarchy of all objects dynamically through schema code in Salesforce I have code like below. Set<String> strForRelatedObjects = new Set<String>(); Schema.SObjectType ...
user avatar
0 votes
2 answers
214 views

Object Relationship Tree

I am currently trying to figure out how to elicit an object relationship tree from Salesforce, so I can export test data to use in my Scratch-Orgs. Basically what I want to do is poll to produce a ...
user avatar
  • 425
3 votes
2 answers
2k views

Get list of all Custom Tabs in an org, including the creator of each

We are trying to clean up the tabs in a demo org (we've reached the limit of 100). I've been looking for a Metadata or Schema API, preferably one I can use from Apex, that will let me query for a ...
user avatar
  • 588

1
2 3 4 5