New answers tagged

2

Dom.Document, despite its namespace, is an XML parser. It is not meant to handle <br>, because XML doesn't allow it. You will need to find/replace all <br> with <br/>. Self-closing tags are just fine, e.g. <hr/>, as well as tags that are simply empty of content (<p/>).


0

Did you tried to check In EmailMessage trigger if email is incoming and has a Support Ticket. You can fetch the case with the support ticket and insert the corresponding thread Id in the body of the incoming email from the client. I believe this should work.


0

Now we can download logs from Logs window in dev console. Right-click on any log in Logs section on bottom side and it gives an option to open the raw file or to download log.


0

How about this: Set<String> DuplicateId = new Set<String>(); Map<Id,OrderItem> uniqueItem = new map<Id,ordereditem >; for(OrderItem itemm : [Select Id,Product2__c from Orderitem where OrderId in :OrderMap.keySet()]) { if(!uniqueItem.containsKey(itemm.Product2__c )) { ...


0

Replay Ids increment per Platform Event SObject type So, if you publish events for Foo__e and Bar__e across the org, each object starts with ReplayId of 0 and increments based on how many events of that object type published org lifetime-to-date Looking at my org where I have a dozen xxx__e SObjectTypes, I see many share the same replayId


1

Try this. It is not an elegant way to solve this problem, but perhaps it should work. Create a Named Credential. Select Identity Type as "Named Principle". Authentication Protocol as "Password Authentication". Write any meaningful Username and paste your access-token in the "Password" field. Disable"Generate Authorization ...


0

Have you tried loading a record using force:recordData? For example, you can put this markup on your lightning component and it should be able to load your data without using Apex at all. This feature is a part of the Lightning Data Service. <aura:attribute name="simpleRecord" type="Object"/> <aura:attribute name="record&...


1

You need to use a describe call for custom settings. If you have a custom setting named CustomSetting__c then use describe call which will return a map of all the fields :- Set<String> flds = CustomSetting__c.sObjectType.getDescribe().fields.getMap().keySet(); It will return a set of Field names for the custom setting


0

You can do this via visualforce, whilst it is finicky, you can create a visualforce action and utilize renderas to render a PDF. This does take time, but you don't need to pay for a package,


0

You can also check the API version from the developer console. SELECT Id, NamespacePrefix, Name, ApiVersion, Status FROM ApexClass where NamespacePrefix = ''


0

When all you need is a count, it's best to not count individual records if you can help it, and you should prefer to use the query to filter out irrelevant results. As a simple fix, you could have: List<Contact> conList = [SELECT Id, Events_Attended__c, (SELECT Id FROM CampaignMembers WHERE Campaign.RecordType.Name = 'ABC') ...


0

Your query is not retrieving any results because the Campaign Record Type Id will be null if you do not query it itself. Please find this blog post which explains this in detail. Best regards!


0

I looked at your code couple of times and it is confusing because the code and the question are not coherent. Do you need to just update any Permit record after project record is created or is there any identifier to update a particular set of Permit records? You need to start your context from Project record after insert perspective


0

Since you want to display all contacts for all accounts in hierarchy you can change your code to find the Account at the top and go downwards from there. This way you can find Accounts in other branches of Account Hierarchy. Also be careful this code will run a lot of SOQL based on the depth of hierarchy. public with sharing class AccountHierarchyController {...


0

I will suggest few things. 1-) Do not use a dml statement (like update,insert,delete) in loops 2-) You can change query to get only the records you need to update 3-) For test class create some records and run the scheduled job (you should also add some negative test cases and write some assertions) Apex Scheduled class public class FutureDatedCasesScheduler ...


0

With an sObject, instead of a concrete type, you need to use dynamic Apex methods: for(sobject c : con){ //Need to Iterate the relationship object based on the condition for(Students_Program__c sp : (Students_Program__c[])c.getSObjects('Students_Programs__r')){ } }


1

It seems fine. You can enhance it by using single query instead 2. map<String, Integer> nameCounterMap = new map<String, Integer>(); for(Contact con : [select ID,LastName from Contact where AccountId =:sourceId or AccountId = :targetId]){ nameCounterMap.put(con.LastName, nameCounterMap.containsKey(con.LastName) ? nameCounterMap.get(...


3

You need to iterate over a list<Sobject> instead of sobject. List<sObject> con = [SELECT Id, firstName, LastName FROM Contact]; You can learn how to loop through element from https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_loops.htm


3

Even if you could reliably authenticate that the incoming call came from a Visualforce page the next step would be to invoke the Javascript Remoting API from something like the browser's developer console. This is arguably easier than using fiddler, since it's using the exact same tools as your intentional Javascript remoting invocations. Attempting to ...


1

There's nothing wrong with your unit test, as far as I can tell. There are many problems wrong with your code. Public with sharing class Case_TriggerHandler extends TriggerHandler { public Case_TriggerHandler(List<Case> newList, Map<Id,case> newMap, List<Case> oldList, Map<Id, Case> oldMap, TriggerOperation type){ super(...


2

Use a generic sObject outside of the if-else block: sObject con; if(enroll =='Y'){ con = [select Id from Enroll_Family_Members__c where Id=:recId]; } else { con = [select Id from Family_Members__c where Id=:recId ]; } con.put('FirstName__c',firstName); con.put('LastName__c',lastName); Note the use of sObject.put to set a field dynamically. When ...


1

I learnt that the way to mock a related list of an object in fflib is by using the method fflib_ApexMocksUtils.makeRelationship. Solution: fflib_ApexMocks mocks = new fflib_ApexMocks(); Opportunity opportunityMock1 = new Opportunity(Id = fflib_IDGenerator.generate(Opportunity.SObjectType)); List<Opportunity> opportunitiesWithProductsMock = (List<...


1

Unicode character 0xfeff is a BOM (Byte Order Mark), and not part of any valid Unicode character page. Some systems may emit this value at the beginning of a file, but Apex doesn't recognize those bytes, causing the problem you see here. As a quick fix, remove those values from the beginning, if present: String fixedString = EncodingUtil.convertFromHex( ...


0

Create a reference to a Flow.Interview, then you can call getVariableName to retrieve the value of a variable from the flow during the process. <flow:interview interview="{!interview}" name="Location_Request" buttonLocation="bottom" allowShowPause="true" showHelp="true" finishLocation="{!returnPage}&...


6

@AuraEnabled annotation is not available for a class, but the only available for static methods. But if you want to obtain a list of Apex Classes with @AuraEnabled methods you can evolve your approach this way: List<ApexClass> apexClasses = [ SELECT Name, Body FROM ApexClass /* WHERE Status = 'Active' */ ]; List<String> ...


1

Right answer is: Datetime userTime = [datetime in user timezone]; Datetime datetimeInGmt = Datetime.valueOf(userTime.format('yyyy-MM-dd', 'GMT')); Now it is displayed properly in UI (first is Datetime in user timezone and second Work Start field in GMT)


1

Use a formula text field to present the GMT value, like: TEXT(TheDateTimeForShowingInGMT__c) Then show that formula on the layout instead of TheDateTimeForShowingInGMT__c.


0

In addition to @AndrewFawcett and @Frederik, I added some useful examples too for you and or future devs Example Suppose that you have a VF Page and also a Custom Controller, and you want to sort your own 'viewModel' objects List The Apex Controller Class public with sharing class YourObjGridListController { public static String sortBy {get; set;} ...


2

There is a ClassName.cls-meta.xml that accompanies your class file when you are using SFDX or metadata API to manage your code base. This includes specification of the API version used for that class. The equivalent information is also available in the Salesforce Setup UI along side the class's code within Custom Code > Apex Classes. In editing a class ...


0

You can pass parameters appended in URL itself. For this, you need to have isUrlAddressable implemented. Documentation link - https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation Copying example from Documentation - You can pass param in URL like this - /lightning/cmp/c__helloTarget?c__title=Director In ...


0

Since you know the input is empty. Its better to add NULL/Empty check and return the response accordingly. E.g. you can have code like this - @httpPut global static String updateRecords () { RestRequest request = RestContext.request; String peticion = request.params.get('peticion'); responseWrapper result = new responseWrapper()...


1

Firstly, it is list of objects in Survey_Choices__c and each object has key-value pair which is how you need to cast and create object. By creating just Map<String, Object>, you are replacing the previous object (Map<String, Object>) in every iteration and so you are seeing just 1 object. You can iterate as below: Map<String, Object> ...


0

After comparing my Postman setup to my Apex code again, I realized that my endpoint was missing the "/api/ppp_loan_forgiveness_requests/" section at the end. After making that change, I no longer receive the 403 error code. Now I receive the 400 error code. That said, this question is resolved I say as 400 is a different issue(field validation). ...


2

You may have messed up the authorization header. The documentation shows: Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b Which means you probably meant to: request.setHeader('Authorization', 'Token '+etranDetails.API_Key__c);


0

Deploying Quick action through Changeset is not possible. ref: https://developer.salesforce.com/forums/?id=906F0000000B59KIAS You can use ANT tool else you need create it manually in target environment.


0

You are in controller function which is in Javascript and Javascript is Case-Sensitive. You are using True, which is not present in javascript. Try updating this block - First way if(res[0].Integrated_lead__c && res[1].Integrated_lead__c ){ toastEvt('Selected Leads are integrated Leads and cannot be merged'); } Second way if(res[0]....


0

You can try this in below way. Any key value you want to pull out, use Map<String, Object> and object part you need to have typecast depending on the key part. Map<String,Object> alistJson = (Map<String,Object>)JSON.deserializeUntyped( response.getbody() ); List<Object> myMaps = (List<object>) alistJson.get('lineItems'); for(...


0

The most simple way to do this is to use http://json2apex.herokuapp.com/. It generates you the JSON-structure that you have to Apex class(es). You can simply put your JSON String into the 'parse' function.


3

System.debug doesn't show parent or child relationships. Use JSON.serialize, for example, to see the values, or you can collect them manually: Set<String> uniqueValues = new Set<String>(); for(Transaction_Property__c property: loans) { for(Transaction_Property__History history: property.histories) { uniqueValues.add((String)history.newValue)...


4

You just need to deserialize the content again: Map<String, Object> payload = (Map<String, Object>)JSON.deserializeUntyped(responseJson); List<Object> results = (List<Object>)payload.get('result'); for(Object result: results) { Map<String, Object> resultContent = (Map<String, Object>)result; Map<String, Object&...


6

The system that is sending you this payload is broken. The best way to address this problem is to fix the remote system so that it sends proper JSON. To address your question as asked, though: you are receiving this error because the first parameter of replaceAll() is a Java regular expression, not a string literal. The { character is being interpreted here ...


0

Per your description you have loop over records and per you make callout and update. If the update is inside the loop then you will get this error (when getting to to next item in the loop) and it doesn't matter if the update is in separate class, workflow , etc... You can write batch class with batch size 1 and then in each execute make callout + update. ...


3

You would need to patch in a field "isNotActive" in your data so you can use the opposing value. There's no way to do otherwise with buttons. If you use the action column instead, you can conditionally determine what to display. This is actually in the documentation: // Other column data here { type: 'action', typeAttributes: { rowActions: this....


1

A few things here. First, scope is a list, so you need to iterate over the list of campaigns passed in: for(Campaign campaignRecord: scope) { Second, your query should filter by status instead of querying the entire database: Contact[] contactRecords = [SELECT Id FROM Contact WHERE Status__c = 'Closed Lost']; Third, it's much more likely that you'd want to ...


0

Below is my understanding :- It's because of the CSS class slds-p-around_medium. This adds padding around the div. If that div is inside the iteration, the padding repeats itself. If it's outside the iteration, I only get one padded div.


0

If you're emailing contacts or leads, you're limited to how many you can send per day (currently 5,000). If you're emailing users, you can email as many as you want. Make sure you're using a User Id as the setTargetObjectId if this is the case.


0

Date values are always interpreted as if they were from midnight in GMT or local time zone (depending on the method you use). Use a DateTime variable instead. DateTime dateUntil = DateTime.parse('7/30/2020, 12:59 PM'); The exact format will depend on your locale; check the documentation for more information. Or, you can use the newInstance method: DateTime ...


0

There is standard 5000 emails limit applied for emails sent through the API(SingleEmailMessage). Pls see the documentation for more details - https://help.salesforce.com/articleView?id=000323568&language=en_US&type=1&mode=1


3

If you want some space left between the cards, you can use margin class like added below(depending on your need either you can make it less or more) - For doing less(try this ) - slds-m-top-xxx-small For doing More(try this ) - slds-m-top-x-small or slds-m-top-small or slds-m-top-medium <aura:component controller="ContactListController"> &...


1

If I understand your question correctly, this compiles and creates 2 records with the same base and additional modifications: @isTest private class TestDemo { @TestSetup static void makeData(){ List<Account> testRecords = new List<Account>(); Account a = new Account(Name = 'Test A', ...


Top 50 recent answers are included