Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
3k views

How to use custom metadata to map generic JSON

I want to create a generic REST API Webservice where the configuration of mapping fields can be done trough custom meta data. How would I set this up?. I want to be able to have an administrator add ...
Thomas's user avatar
  • 2,320
0 votes
2 answers
832 views

updating reference field using generics sObject

I am trying to perform upsert on opportunity based on external Id. I am building the opportunity objects based on sObject as I am using that function for other objects too. Now Opportunity object ...
Hunt's user avatar
  • 245
8 votes
3 answers
6k views

How to accept generic "SObject" in Lightning Web Component for Flows?

I've got a custom built LWC to be used within a screen component in a flow. My component basically renders a collection of SObjects in a distinct way. It can also deal with different types of sObjects....
Christoph's user avatar
  • 1,022
2 votes
1 answer
79 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 ...
Brian Kessler's user avatar
4 votes
2 answers
449 views

How can I upsert a homogeneous List<SObject>, in a good way? [duplicate]

I have some abstracted code, which at the end of some process will create a homogeneous list of SObjects. It could be a list of Accounts, it could be a list of contacts, it could be a list of some ...
Brian Kessler's user avatar
1 vote
1 answer
1k views

Generic SObject Utility to dynamically set field values from Map

I'm trying to create a generic utility method which takes a List of sObjects and a Map of fieldNames to fieldValues. I'd like to, for example, do the following: List<Lead> leadList = [SELECT Id ...
Mike's user avatar
  • 1,209
8 votes
1 answer
2k views

Pros and cons of generic SObject list vs multiple lists of objects

For one of the requirements I have to write code to update multiple records of different objects. Originally I was planning to do the obvious: get needed records, change some value, update these lists,...
Novarg's user avatar
  • 5,294
3 votes
1 answer
2k views

Is it possible to write a method that accepts both SObjects and Apex Class Instances?

I have an Apex method that takes a list of SObjects, a source field name, and a destination fieldname. For each SObject in the list, it looks at the source field, does some work, and populates the ...
Jason Clark's user avatar
  • 12.1k
33 votes
1 answer
8k views

Generic Apex Trigger

So I was kind of throwing round the idea of making a generic apex trigger that is callable by multiple objects. Say you have the following sObjects: Account Sales__c Sales_Contacts__c And I wanted ...
gfppaste's user avatar
  • 845