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
0 votes
1 answer
151 views

Type.ForName is not working in apex

I have an implementation where i'm storing class name in custom metadata & trying to instantiate the class in apex using Type.forName but getting: Method does not exist or incorrect signature: ...
Soumi's user avatar
  • 75
-1 votes
1 answer
1k views

Where can I find the field names of individual fields in the Address compound field

I am pretty new to Salesforce. I have just learned that the Address and Name field in the contact object are compound fields consisting of individual fields. Where can I find the field names of the ...
Yadhu Anand's user avatar
0 votes
0 answers
132 views

Code Coverage for JSON Deserialize Typed

I am having trouble getting test code coverage for a JSON response that I'm deserializing typed, and am not exactly sure how to properly test. Any advice would be appreciated! Here is the code I'm ...
happylittletrees's user avatar
1 vote
1 answer
24 views

Salesforce Instance Type Required

We are using Salesforce OAuth webserver flow to connect with external salesforce system. To have a valid ClientId and ClientSecret we need to order a Salesforce instance. Can you please guide which ...
user3187179's user avatar
0 votes
1 answer
31 views

How can I find where is a help message in the component?

There is a field 'Email' that has a validation message in case of invalid inputs when it loses focus (like in the picture, for example). I have to know the rule of this message, but I can't find where ...
Cline's user avatar
  • 143
0 votes
1 answer
3k views

global methods do not support return type of wrapperclass

i am getting of error global methods do not support return type of ContractResponseWrapper line is global static ContractResponseWrapper postMethod() i think i could'nt able to send wrapper class ...
chiranjeevi gadamsetty's user avatar
0 votes
2 answers
48 views

Doubles and Integers adding up differently

System.debug(116 - 80 - (10 * (100 - 10)/ 100) - 10 - 20 - ((20 / 100) * 116)); // -3 System.debug(116.00 - 80.00 - (10.0000 * (100 - 10.00)/ 100) - 10.00 - 20.0000 - ((20.00 / 100) * 116.00)); // -26....
Tyler Zika's user avatar
  • 2,818
1 vote
0 answers
625 views

Inline validation for Number type input in lightning-datatable [closed]

Is there any way to validate input field of type number in lightning-datatable, like it is in input field of type currency? I want to have 3 maximum fraction digits. And check validation on inline ...
Ninja Potato's user avatar
0 votes
1 answer
240 views

Judge an apex object is a class type not a specific class type

We can use instanceof keyword to verify an object is a specify object type, like Id, String, Integer, Datetime... Object str = 'aaa'; System.debug(str instanceof String) // true public class ...
Gary Chen's user avatar
0 votes
1 answer
486 views

Manage Object of unknown Type

This may sound silly but i am really stuck... I have installed a custom managed package which gives the ability to use plugins and call from Javascript Apex. JS Code: //Initialize object to be ...
Giorgos Galaios's user avatar
5 votes
1 answer
780 views

Must I cast a JSON deserialization into an object?

The Apex Developer Guide discusses the deserialize(jsonString, apexType) method of the JSON Class here, with the given example: Decimal n = (Decimal)JSON.deserialize('100.1', Decimal.class); System....
Gabriel Rivera's user avatar
2 votes
1 answer
296 views

How to call an Apex Class and method using Type casting?

I would like to call someMethod1 and someMethod2 from myClass from a Trigger on update. How can I use type casting to call the two methods? myInterfaceClass public interface myInterfaceClass { void ...
usernameabc's user avatar
2 votes
1 answer
378 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 ...
Vneq's user avatar
  • 79
1 vote
1 answer
106 views

Is there any typesafe way to refer to Queues in Apex?

Let's say I have a Queue named "My Queue 123" with a Developer Name of "My_Queue_123", is there any typesafe way to refer to it in Apex? Or can I only pass it around as a string?
Brian Kessler's user avatar
1 vote
0 answers
666 views

Should it still be possible to access public classes belonging to managed packages?

There is a critical update, Restrict Reflective Access to Non-Global Constructors in Packages When this critical update is enabled, regardless of API version, you can initiate only Apex classes that ...
Jeff's user avatar
  • 909
2 votes
1 answer
1k views

If I know the class type of an Enum, how can I get a list of the values?

I have the following method: public XAP_ENUM_EnumConverter put(Type enumType, XAP_ENUM_EnumWrapper enumWrapper) { ENUM_WRAPPERS_BY_TYPE_MAP.put(enumType, enumWrapper); return this;...
Brian Kessler's user avatar
3 votes
2 answers
828 views

Type.Forname() throws null pointer exception

I have a managed package 'A' which has a global interface with a method global interface Ivehichle { string getEngineName() ; } In the managed package B, i am implementing this interface Ivehicle ...
ragaut's user avatar
  • 33
0 votes
2 answers
1k views

Set record type when creating an object without using RecordTypeId [closed]

I have a custom object with two record types, How can I set the record type using the record type name when creating a new object record?? Without using the RecordTypeId is possible?? I think is not ...
Mar Andrés López's user avatar
0 votes
1 answer
87 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 ...
Randy B.'s user avatar
  • 139
1 vote
1 answer
87 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 ...
S.B.'s user avatar
  • 2,039
1 vote
0 answers
23 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 ...
Felipe ZC's user avatar
1 vote
1 answer
1k 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 ...
Thomas's user avatar
  • 2,294
3 votes
1 answer
2k 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 ...
manymanymore's user avatar
4 votes
2 answers
705 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 ...
Brian Kessler's user avatar
0 votes
1 answer
2k 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 ...
cbarkoczi's user avatar
14 votes
2 answers
5k 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(...
Brian Kessler's user avatar
5 votes
1 answer
2k 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 ...
Joel Gerber's user avatar
3 votes
1 answer
82 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 ...
Renato Oliveira's user avatar
0 votes
3 answers
2k 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){ ...
sf_user's user avatar
  • 2,208
2 votes
1 answer
258 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 ...
mmm321321's user avatar
  • 639
1 vote
1 answer
2k 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( ...
Daniel Ballinger's user avatar
1 vote
1 answer
2k 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: ...
Alex Marvick's user avatar
2 votes
2 answers
3k 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 ...
Nebbyyy's user avatar
  • 838
1 vote
0 answers
24 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 ...
SFAdmin's user avatar
  • 11
2 votes
1 answer
2k 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 ...
Guillaume's user avatar
  • 105
4 votes
1 answer
5k 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
benahm's user avatar
  • 2,567
1 vote
2 answers
3k 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 ...
Matt Korlath's user avatar
0 votes
0 answers
63 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 ...
m0gul's user avatar
  • 51
3 votes
3 answers
8k 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: ...
Renato Oliveira's user avatar
5 votes
2 answers
5k 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 ...
Mossi's user avatar
  • 3,906
4 votes
2 answers
2k 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. ...
nickforce's user avatar
  • 417
4 votes
2 answers
64 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, ...
Adrian Larson's user avatar
  • 149k
11 votes
1 answer
2k 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 ...
Matt Lacey's user avatar
  • 25.3k
18 votes
2 answers
21k 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 ...
Xtremefaith's user avatar
  • 4,520