Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [type]

The Type Class contains methods for getting the Apex type that corresponds to an Apex class and for instantiating new types.

Filter by
Sorted by
Tagged with
11
votes
1answer
932 views

Accessing Multiple Fields From a SOQL Query Using FORMAT()

The Setup I've got a horrible feeling I'm being rather dumb and can't see the wood for the trees here, but how do you get more than one field returned when using the SOQL FORMAT() function? The ...
10
votes
2answers
7k views

APEX: Use a dynamic string to create an instance of a class

I have an abstract class called Process that I extend to create a list of processes (List<Process>); each in relation to an object. For now everything works as expected but I'm really hoping to ...
9
votes
2answers
1k views

What is an elegant way to catch multiple exceptions without catching generic exceptions?

I don't want to catch generic exceptions, but I want to handle all the exceptions I want to catch exactly the same way. For arguments sake, lets say the code is: try { doSomething(); } catch(...
5
votes
2answers
2k views

Check if object instance is of type X

How can I see if an instance of a class is of a particular type? See example code below: IMyInterface m = new MyClass(); Type t = MyClass.class; // how can I know if m is of type t? Based on other ...
5
votes
1answer
676 views

<lightning input type=“search”> reset to call a controller?

I using the search type input in a lightning component to do a dynamic search on a given field from a custom object. I've noticed when you click on the "X" to clear the data that came back from the ...
4
votes
2answers
120 views

Is there a typesafe way to work with rowCause?

On the project I'm currently working with, we have Apex Sharing Rules. I see we are passing rowCause as a String everywhere. But the values of these Strings look like API names. Is there a typesafe ...
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, ...
3
votes
2answers
920 views

Compile error: Variable Does not exist while attempting JSON deserialize

Not sure if this is a platform bug or by design feature with case insensitive variable names?, but it gave me a lot of trouble so wanted to post a question about it to document the workaround I found. ...
3
votes
1answer
70 views

Quote.class doesn't return the Quote type, but Account.class does. Why?

I'm trying a library that acts like an object factory. It works with serialization, so it is possible to specify formula fields without DML, which is pretty handy with tests. My issue is that I'm ...
3
votes
1answer
217 views

Find out what instance of SFCC do I have

How can I find out what instance of SFCC do I have? I am very new to SFCC and I was provided with the account of SFCC by my employer. So, now I want to learn the SFCC. For this I go to the ...
3
votes
3answers
1k views

Cannot convert list of objects to specific type

I've created a method to extract a specific field from a list of sObjects, and since it accepts any sObject, I return a list of Object too, since field types can vary. So the method is as follows: ...
2
votes
1answer
910 views

Invalid Type when trying to create Platform Event

Ive created a platform event in salesforce and am unable to reference it in my code to trigger the event, below is my event object I have created. The error I am receiving can be seen below ...
2
votes
1answer
61 views

Dynamically get object type (something like this.class)

I've got a base class BaseClass and a bunch of derived classes MyClass1, MyClass2. Now, I want to be able to get Type of derived class at the level of BaseClass. I found online some workaround for how ...
2
votes
1answer
580 views

Visualforce dynamic sObject table column value formatting

I want to allow my team to display some leads and tasks (and any known object) with custom conditions and display all the data on only one screen. I made some custom objects "blocks" containing SOQL ...
1
vote
1answer
67 views

Variable does not Exist: CaseTrigger

I'm trying to pass a value to a variable in an apex trigger from an apex controller in an effort to control whether the the code in the trigger is executed. In myController initialization, I try to ...
1
vote
1answer
435 views

How can I create a Map<Id, Account> from a List<sObject> parameter when I know all the records are Accounts?

I'm doing some work with the ESAPI Library. In particular, when updating records it is used to enforce FLS with the following method: global SFDCAccessControlResults.UpdateResults updateAsUser( ...
1
vote
1answer
160 views

Invalid type for implements System.Schedulable Class [closed]

I have the following class which I try to schedule from the anonymous window but this gives the error: invalid type:abc_RiskSchedulerProcessor Class global class abc_RiskSchedulerProcessor ...
1
vote
2answers
1k views

ComputeExpression Date Formatting

Trying do do a basic ComputeExpression with a date type that picks one of 2 dates using a case statement. Dataflow fails on the ComputeExpression step with this error message: expression data ...
1
vote
0answers
16 views

Type Cast Version 14.0 SObject to Version 45.0 SObject in Java

I am performing maintenance on an old Java application that uses version 14.0 Java Stubs to perform SOAP operations. Need to integrate ETM 2.0 objects into this application, is there anyway to type ...
1
vote
1answer
173 views

Flow not creating a new record?

I'm relatively new to Salesforce development. Right now, I'm making a voting app that contains two objects; a contestant object and a vote object. Each object has the following fields: Contestant: ...
1
vote
0answers
19 views

How can I get a product to be visible on a Lookup search [closed]

I want the product related to a opportunity to populate in the search field when I'm linking an opportunity to an Event. I've added a picklist and the product for each opportunity is visible when ...
0
votes
3answers
490 views

Use Type class to call parameterized constructor

Using this to get below working: public class t12345 implements Database.Batchable<sObject> { String query; Boolean xyz; public t12345(String query){ ...
0
votes
1answer
52 views

Invalid Conversion Runtime Type List<> to Map<>

I understand I am getting this error on the map line but I do not understand why. As the method does return the list I am constructing. What am I missing about this exactly? The dataRequest starts as ...
0
votes
1answer
1k views

Test if a variable is instance of List regardless of type

How to test if a variable obj is instance of a list regardless of the type that list is holding I have tried obj instanceof List obj instanceof List<> But I'm getting a compile error
0
votes
1answer
356 views

How do I check the RecordType of an Opportunity?

We have a trigger in our org that will clone Opportunities if they meet certain criteria. Due to recent changes in our business though we now have to account for certain record types (i.e we only want ...
0
votes
0answers
56 views

Is there anywhere I can see the code for the Napili Template Custom Layout Types?

I'm really wanting to see the Napili Template code for a number of reasons, that would REALLY help me out. I'm wanting to see how to: Get the "company logo" from the "branding" section of the ...