Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

New answers tagged

1 vote

Error dialog box when click on button to run API call through APEX class using LWC

I found the Issue, I was not importing the apex class function. getJwt that was defined in Apex class was not imported in instanceList.js. Adding import getJwt from '@salesforce/apex/InstanceService....
Syed Haris Ali Ghaznavi's user avatar
0 votes
Accepted

I am trying to create an agreement using transient document in adobe sign using rest api.Following is my code snippet:

I was having a similar issue when creating a widget with a transientDocumentId, and it showed the document contents as a base64 string of text. This is because EncodingUtil.base64Encode takes a Blob ...
ClaytonC's user avatar
0 votes

Connecting standalone LWR SPA and Apex Class to get access token

Auth.AuthToken.getAccessToken is used in Salesforce (Apex) to get the token for access to an external system that has been authorized via OAuth. To log in to Salesforce, you must log in to Salesforce. ...
sfdcfox's user avatar
  • 494k
0 votes

DML Statements Inside Loops Issue in Salesforce Apex Code

The method looks fine, it's how you call it is the problem. Look at the top lines of the findings (except I tweaked the text a bit for readability) // in file: classes/Util.cls L 1000: for (Sobject ...
eyescream's user avatar
  • 24.1k
1 vote

Metadata API ServiceController

As long as your org is configured to allow this, you can access the metadata API directly. For example, you can use the readMetadata and updateMetadata calls directly, which are synchronous calls. ...
sfdcfox's user avatar
  • 494k
0 votes

How to mock when calling a factory class

I would just follow the standard fflib pattern here for service classes Production Code public with sharing class RecordCreationController { @AuraEnabled public static Map<String, Object> ...
cropredy's user avatar
  • 71.8k
0 votes

How to get only the value of two fields from a report of my Salesforce ORG via GET

If you change your API to add ?includeDetails=true as in: `https://abc.sandbox.my.salesforce.com/services/data /v44.0/analytics/reports/00O2C000000eX7KUAU?includeDetails=true You'll get ...
cropredy's user avatar
  • 71.8k
1 vote

How to mock when calling a factory class

Like I said in my comments, I don't think that there's much you can do to reduce the amount of setup that you need to do. That said... The simplest way (probably) The simplest way is to create an ...
Derek F's user avatar
  • 62.1k
1 vote

Notification not getting fired from apex

My changes were not getting reflected in the org. Before Change: if(String.isBlank(subject)){ notification.setTitle('Broadcast message'); System.debug('...
code234's user avatar
  • 196
0 votes

How salesforce can suscribe to events happening in external system

You can use the pub/sub API (gRPC) to publish events from an external system to Salesforce (as Platform Events) which you can then process with Apex/Flows. There is a helpful walkthrough from ...
Arthur Noort's user avatar
0 votes

Why am I able to see a lookup record's name field if I don't have access to the record

If your vfp is using a custom controller, then consider using the "with sharing" keyword to potentially circumvent your issue. Another tool to consider could be permission-gating lookup ...
Peter Noges's user avatar
  • 1,130
2 votes

I have added assert but while running test it is getting failed with this error ' Assertion Failed: Expected: null, Actual: Meeting Held'

The main issue You're using the wrong version of the System.assertEquals() method. There are 2 versions. One takes 2 arguments, the other takes 3. System.assertEquals(<expected value>, <...
Derek F's user avatar
  • 62.1k
1 vote
Accepted

Not able to share files with external users

@Mitesh Sura if(Trigger.isInsert && Trigger.isBefore) { for (ContentDocumentLink cdl : Trigger.new) { if(cdl.LinkedEntityId!=null){ if (cdl....
Jenifa Pearlin's user avatar
1 vote

How to decrypt an encrypted incoming webhook payload

Data is a base-64 encoded string, and the secret key appears to be a 256-bit private symmetric key (just guessing, based on the length). As such, you're going to need to first use EncodingUtil....
sfdcfox's user avatar
  • 494k
0 votes

ERROR No subscriber package version found for package id 'XXX' while creating package in CI/CD

Two additional causes of this error message when running the newer sf package install: omitting the Installation Key if one was provided during package version creation providing the wrong ...
Jason Clark's user avatar
  • 11.9k
1 vote

DML operation Insert not allowed on Survey in the test class

As you can see from the Object Reference Doc for Survey, you can't use DML to create this object. Note that for deployment purposes, Surveys are Flows. Supported Calls describeLayout(), ...
cropredy's user avatar
  • 71.8k
2 votes

How to Check if LWS (lightning web security) is enabled inside Apex or LWC

We articulated how to approach this via the developer blog here In nutshell you can use below code function hasLightningWebSecurityEnabled() { try { new Worker(); } catch ({ message }) { if (...
Mohith Shrivastava's user avatar
0 votes

Salesforce data move utility (SFDMU) plugin

Have recently used this to migrate Salesforce record data from one scratch org to another scratch org. It is simple to set up the export.json file - for the OP's example it would look like this: { &...
edralph's user avatar
  • 562
0 votes

help with dateTime to extract only time

Another way to do it if you need the hour and minutes in integer: Datetime dt = System.now(); Integer hm = dt.hour(); Integer mm = dt.minute(); Integer ss = dt.second(); System.debug(hm+','+mm); P.S: ...
Ayub's user avatar
  • 3,533
1 vote

My APEX codes are returning wrong datetime?

You put a literal 'Z' into the date format string, so it deceived you. Simply changing it to use the Z format will tell you a different story: String dateTimeQuery = ' WHERE LastModifiedDate >= ' + ...
sfdcfox's user avatar
  • 494k
2 votes

Apex: Ternary operator and SonarQube warning

I think you meant UserWrapper.isManager() in both instances, rather than User.isManager(). Maybe that's causing the confusing error? That said, there's a more modern way to write your code, assuming ...
sfdcfox's user avatar
  • 494k
0 votes
Accepted

How can I discover the users and emails from a group email using Apex?

The Group object has an Email field. If you query the group table in your org with this given email, should it return one or more groups, you may use the group identifiers to query the GroupMember ...
Renato Oliveira's user avatar
1 vote
Accepted

Can we rely on reference when it comes to changing Map items changing?

shows both single and array entries. To be more accurate, it shows array entries with one or more entries. In your map's data type, you can't mix arrays and strings. tempo is the matter - looks like ...
sfdcfox's user avatar
  • 494k
0 votes

Apex call returns successfully after errror, resulting in issues

As @sfdcfox pointed out, it seems indeed there was an issue that the user was able to press the button twice, with calls conflicting each other. I implemented a way to disable the button until it ...
Z0q's user avatar
  • 59
-2 votes

How to delete document in content version?

Another observation as I saw with trying to delete record in ContentDocument object even though logged in user has ModifyAll permission on Parent record is that, I had to declare the class as "...
Biswajit Samantaray's user avatar
0 votes

Is there a way to report on attachments?

You might want to consider the declarative roll-up summary tool. https://sfdo-community.github.io/declarative-lookup-rollup-summaries/ You would have to build a roll-up for each object but it would ...
Benjamin Pirih's user avatar
-5 votes

Is there a way to report on attachments?

Hope all of you are doing well! I have developed an app which can help you in getting the required information. This app works for all Custom as well as Standard object. By using this app you can - ...
Sumit's user avatar
  • 1
1 vote

Error while updating Lookup field on Case recprd after insert from Web-to-Case form

This is because you are in an after-insert trigger and the records are read-only in that context as they have been written, but not committed, to the database. To avoid this error you can use a before ...
Tushar Jadav's user avatar
  • 1,954
3 votes

NavigationMixin - file preview - Failed to Load inside slds-file_card div

You need to use selectedRecordId instead of recordIds. e.g. handle Click(event) { alert('Inside'); this[NavigationMixin.Navigate]({ type: 'standard__namedPage', attributes: { ...
Nick C's user avatar
  • 6,740
0 votes

Property type misidentification in VisualForce Page

I resolved the issue - I changed public Account acc in the apex extension to public Account acnt and changed it in the VF Pages too, and now these errors have gone. It appears to be associating acc ...
cyberspy's user avatar
  • 210
1 vote

Why does `EntityDefinitionId` works like SObjectType in following code?

Why ... ? We don't know, because the documentation doesn't tell us. Presumably, it's to make our lives easier when performing queries, because we don't have to query CustomObject or EntityDefinition ...
sfdcfox's user avatar
  • 494k
0 votes

How to manage both single and an array of json reponse from the same external system?

I don't think there is a better way to go about this than you're already doing. Checking the first character is about as quick/easy/simple as it gets. You could use the JSONParser class for this ...
Derek F's user avatar
  • 62.1k
0 votes

How to manage both single and an array of json reponse from the same external system?

String jsonStr = '[{"name":"Ajay"}, {"name":"Sohan"}]'; Object obj = (Object)JSON.deserializeUntyped(jsonStr); System.debug(obj instanceOf List<Object>);...
Md Shahbaz's user avatar
5 votes

How to write SOQL query to get accounts where billing city equals to shipping city in single query?

If the two fields are on the same record, this is approached by using a custom Checkbox formula field to do the comparison, then querying using that Checkbox field. E.g. the field might be ...
Phil W's user avatar
  • 36.7k
1 vote

Verify Email addresses in LWC

To property validate emails, you need a much more complicated regular expression, as outlined in this Stack Overflow answer. That said, LWC already has built-in email address validation. Just change ...
sfdcfox's user avatar
  • 494k
2 votes

Verify Email addresses in LWC

I would go back to the source on this. What is the problem you are trying to solve? Checking for a valid looking email address solves users entering their name in the wrong field etc. It won't solve a ...
Hutchenstein's user avatar
0 votes

How to fetch contentNote records as per the contact record?

You can retrieve all Notes for a parent record by querying on ContentDocumentLink and ContentNote objects. A ContentDocumentLink record is created for each ContentNote entry. ContentDocumentId field ...
Cb Shivananda's user avatar
0 votes

how to read all Content Notes saved as 'SNote' (Beta New Notes feature) for a Parent record all users?

You can retrieve all Notes for a parent record by querying on ContentDocumentLink and ContentNote objects. A ContentDocumentLink record is created for each ContentNote entry. ContentDocumentId field ...
Cb Shivananda's user avatar
0 votes

system.limitexception: too many callouts: 101 error Salesforce

You can re-write the for (String value : batch) { loop into a future method or a Queueable. This is still a bad architecture, but at least it will work. I would try to utilize the Batchable interface. ...
Andrii Muzychuk's user avatar
1 vote

Verify Email addresses in LWC

There isn't a way to verify that email exists using pure JS. What you could do is basic regex validation as you are doing. Or use a 3rd party service but you said you do not want to. See this for more ...
Liam Gatt's user avatar
  • 139
1 vote
Accepted

Formula Field - Apex code issue

It appears the field name is Date_of_Birth__c (note: lowercase o), but you referenced it as {!PGs.Date_Of_Birth__c} (note: capital O). JavaScript is cAsE-sEnSiTiVe, but Apex isn't. When using Aura or ...
sfdcfox's user avatar
  • 494k
2 votes
Accepted

Moving code from unlocked package back to "happy soup" - how?

how can we get Salesforce to "un-link" the class from the pacakge it's no longer part of? Go to Setup > Installed Packages > Package Name > View Components. You can individually ...
sfdcfox's user avatar
  • 494k
0 votes

Safely Storing Client Credentials in Salesforce?

Answering my own question: I ended up encrypting the credentials and storing them in the custom metadata record linked to the Auth. provider. There seems to be no way of achieving this when it comes ...
sfdcnewbie's user avatar
1 vote

I need to create a batch class that summarizes all Opportunity Amounts for each Account;

You're using Messaging.sendEmail inside a loop. You are limited to 10 invocations of this method per transaction. Add all of the emails you want to send into a list, then send the emails at the end. ...
sfdcfox's user avatar
  • 494k
2 votes
Accepted

How to wait for a VisualForce script to execute when calling it from an Apex method via PageReference?

When you call PageReference.getContent() like this, it only loads the emitted HTML from Visualforce. You're not in a browser environment, so Apex can't run the JavaScript. You've already outlined two ...
sfdcfox's user avatar
  • 494k
0 votes

Why is my date of week printing one day behind today?

I believe your datetime field has the timezone in it, so you'd want to use formatGmt, format alone does the current user's timezone. String dayOfWeekString = endDateDT.formatGmt('EEEE');
veritascs's user avatar
  • 211
3 votes

LWC Wired method not working

@wire(updateStatusOpen, { userId: '$userId' }) should be: @wire(updateStatusOpen, { userId: USER_ID }) The '$fieldName' format is only for variables in the class. However, be aware you can't perform ...
sfdcfox's user avatar
  • 494k
1 vote
Accepted

How to prefill lookup value in lightning web component

@thomas **Apex** @AuraEnabled(cacheable=true) public static List<Ambassador_Event__c> getAE(){ return [select id,Ambassador_Event__r.Name from opportunity limit 2]; ...
Jenifa Pearlin's user avatar
0 votes
Accepted

System.QueryException: Record Currently Unavailable

This has been resolved by removing the OR UPDATE from the SOQL.
Thomas's user avatar
  • 2,298
1 vote

Unicode non-breaking space is not considered white space?

In addition to the other answers, this can be useful in your regex If using REGEX to find whitespace characters, you might be tempted to use \\s* -- but this finds only ASCII spaces. It will not find,...
cropredy's user avatar
  • 71.8k

Top 50 recent answers are included