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
1 vote
1 answer
23 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 ...
user avatar
0 votes
1 answer
24 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 ...
user avatar
  • 123
0 votes
1 answer
384 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 ...
user avatar
0 votes
2 answers
30 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....
user avatar
  • 2,688
1 vote
0 answers
191 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 ...
user avatar
0 votes
1 answer
61 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 ...
user avatar
0 votes
1 answer
150 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 ...
user avatar
4 votes
1 answer
400 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....
user avatar
1 vote
1 answer
73 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 ...
user avatar
2 votes
1 answer
138 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 ...
user avatar
  • 69
1 vote
1 answer
36 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?
user avatar
1 vote
0 answers
468 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 ...
user avatar
  • 849
2 votes
1 answer
337 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;...
user avatar
3 votes
2 answers
476 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 ...
user avatar
  • 33
0 votes
2 answers
548 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 ...
user avatar
0 votes
1 answer
79 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 ...
user avatar
  • 139
1 vote
1 answer
78 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 ...
user avatar
  • 1,808
1 vote
0 answers
22 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 ...
user avatar
1 vote
1 answer
832 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 ...
user avatar
  • 2,068
3 votes
1 answer
1k 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 ...
user avatar
4 votes
2 answers
430 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 ...
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 ...
user avatar
12 votes
2 answers
3k 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(...
user avatar
5 votes
1 answer
1k 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 ...
user avatar
3 votes
1 answer
78 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 ...
user avatar
0 votes
3 answers
1k 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){ ...
user avatar
  • 2,168
2 votes
1 answer
129 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 ...
user avatar
  • 557
1 vote
1 answer
1k 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( ...
user avatar
1 vote
1 answer
1k 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: ...
user avatar
2 votes
1 answer
2k 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 ...
user avatar
  • 822
1 vote
0 answers
23 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 ...
user avatar
  • 11
2 votes
1 answer
1k 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 ...
user avatar
  • 105
3 votes
1 answer
4k 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
user avatar
  • 2,367
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 ...
user avatar
0 votes
0 answers
62 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 ...
user avatar
  • 51
3 votes
3 answers
5k 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: ...
user avatar
5 votes
2 answers
4k 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 ...
user avatar
  • 3,764
4 votes
2 answers
1k 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. ...
user avatar
  • 397
4 votes
2 answers
61 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, ...
user avatar
  • 142k
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 ...
user avatar
  • 24.7k
15 votes
2 answers
15k 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 ...
user avatar
  • 4,368