Questions tagged [apex]

Questions relating to Apex, the native programming language for the Force.com platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.

Filter by
Sorted by
Tagged with
1
vote
0answers
5 views

How to adjust column widths in Visualforce to PDF email attachment?

I wish to send a visualforce page as an email PDF attachment to user. The problem I am facing is that the columns don't fit in the PDF. Hence I sent the PDF in landscape mode. After that, some extra ...
0
votes
1answer
13 views

Why does a name change result in an invalid type?

I have two Apex classes that differ by literally only their name. Here's MaintenanceRequestBatch.cls: public with sharing class MaintenanceRequestBatch implements Database.Batchable<sObject>{ ...
0
votes
1answer
28 views

Do I need a ETL tool for Enterprise Integrations? [closed]

I have worked with five end to End Integration using Several ETL tools like IBM integation bus, Informatica , Mule soft, Cast Iron, SAP PI etc.,, Some times the clients are having a little cash crunch ...
0
votes
1answer
21 views

Upsert without an external Id

We have external system that is pushing an event using Platform events saying that an asset is changed. I have created a Platform event object and a trigger on it, make a webservice callout to get ...
-2
votes
1answer
24 views

I'm a mechanical engineering student, I don't know anything about coding. by learning Salesforce how much will it help with my career [closed]

I'm a mechanical engineering student, I don't know anything about coding. by learning Salesforce how much will it help with my career. Please help should I learn it or not
0
votes
0answers
9 views

How to Add Docusign Signature and Date Tags to Dynamic PDF Creation

I'm trying to determine if it is possible to embed the Docusign Signature and Date tags into apex code that dynamically generates a PDF file using XMLStreamWriter. The PDF file is generated from the ...
0
votes
0answers
22 views

Upload csv files from ftp into SF via Apex (without insertFile Tag) [duplicate]

I want to automatically upload csv files into Salesforce on a regular basis, doing a scheduled job. I want to have this job centralized so that everybody has access to the code and the process. I want ...
0
votes
0answers
13 views

How to retrieve a current user's OpenID Connect ID token via apex?

Question: Is there any method for retrieving the current user's OpenId Connect (OIDC) Id Token via apex? Background Context / Goal: My goal is to set up Single logout for a salesforce community that ...
-1
votes
1answer
20 views

Dynamic Variable Scheduler Class

I'm looking to pass a variable to my scheulder class when scheduling a batch job. The idea is that I'm scheduling the class multiple times, but passing in a different variable each time. Example: ...
0
votes
2answers
27 views

Render Apex page via API and getting response?

We have API access via REST and need to grab the contents of a rendered page located at https://xyz.visual.force.com/apex/page?id=x Is there any API or way to render this remotely?
0
votes
1answer
28 views

In which orgs is possible to upgrade managed package

Is it possible to upgrade a managed package, not in main Dev Hub org and its scratches? I mean in some not related to the Dev Hub org. We have a git repository with code from the managed package and ...
0
votes
0answers
19 views

Getting files stored in Amazon S3 Bucket [closed]

I am trying to get stored files from the Amazon S3 bucket. There is a FolderA in the S3 bucket which has image1.png, image2.png, image3.png. How can we get all these files dynamically using APEX? What ...
-1
votes
3answers
28 views

batch apex opportunity records are not updating with compare of metadata records

Opportunity records fields compareing with custom metadata record and based on values match opportunity stagename will update but it is not working and gettin error in apex job also that duplicate id ...
0
votes
1answer
26 views

How to generate signed JWT token in Apex using JWK keyset

How to generate signed JWT token in Apex using JWK keyset. I know Auth.JWS can be used to generate bearer token. JWS(jwt, certDevName) but it uses certificate to generate token. My requrement is ...
0
votes
1answer
9 views

Einstein Bot with Apex Rest Callout Error: INSUFFICIENT_ACCESS

My Einstein Bot is asking for some parameters and should call an Apex Class with those parameters. There is one Class kinda like a Controller which is called by the Einstein Bot itself, which calls ...
0
votes
0answers
35 views

INVALID_FIELD error on User.ProfileId for Salesforce Platform User

We have a running application that has a custom lightning component to create partner users. User is successfully created in the context of System Admin. But when trying to create a partner user in ...
0
votes
0answers
10 views

customize chatter email Notifications

let's say we have an object called work and we post chatter on the object and the person who tagged to the post will receive an email regarding the post. The problem above is the person tagged is ...
0
votes
1answer
24 views

How to merge content from two .doc files into one using JavaScript in LWC or Apex [closed]

I have an input type file which takes two .doc files. Then I need to merge content from this files into one .doc file and download it. I supposed it is needed to read files as ArrayBuffer and then ...
1
vote
2answers
20 views

Khmer fonts in VF page for PDF rendering

I am not sure why Khmer fonts are not supported in Visualforce page. The below are the fonts that are supported by VF page. Font Type Fonts Arial Unicode MS Arial Unicode MS Helvetica sans-serif, ...
0
votes
1answer
17 views

Trigger to limit products being added across all opportunities

I have a use case where I need to limit the number of two products that can be added across all opportunities. For example "Product A" and "Product B" can only be cumulatively ...
0
votes
0answers
33 views

Technical Feasibility - converting a CURL to Apex

Caveat, I am very unfamiliar with APEX and coding in general. Objective: I am trying to post to Einstein Named Entity Recognizer API. The docs provide this curl example: curl -X POST -H "...
0
votes
0answers
5 views

Show data sent using live agent rest api

I'm writing a code that does Live agent integration with an external system using express js. The integration is working awesome. Here my external system is a python based chatbot. I do some bot chat ...
0
votes
0answers
10 views

Compile time error in time expression in Apex code [duplicate]

I am getting this error : Time expressions must use Integer or Long. For this piece of code. Long millis = (eachRemRecordToBeUpdated.EndingWorkHour__c ) - (eachRemRecordToBeUpdated.StartingWorkHour__c)...
0
votes
2answers
37 views

Json Unexpected character (':' (code 58)): was expecting comma to separate ARRAY entries at [line:1, column:83]

I have a Json string to do some testing on nested Json but get te error:Unexpected character (':' (code 58)): was expecting comma to separate ARRAY entries at [line:1, column:83] I can seem to figure ...
0
votes
0answers
14 views

Custom Flow Navigation Through Multiple Screen

I am using custom navigation for the flow embedded in lightning component. I want to skip multiple screens on next click. How can i navigate multiple screens at once? For example Screen 1 to Screen 4 ...
0
votes
1answer
32 views

How to count an average date?

My accounts have the Date field Activity__c. How can I figure out an average date between all these Activity__c fields and define the closest date to the average date? I tried to use SOQL: [SELECT AVG(...
0
votes
0answers
11 views

VF Page rendered as pdf inside another vf page

To generate quote templates, I have created my custom template using vf pages, which will be rendered as pdf. I'm able to render that pdf correctly. Now what I want is to show the rendered pdf similar ...
0
votes
1answer
28 views

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_FILTER_VALIDATION_EXCEPTION

We did a minor modification to our code in the If/Else statement in our class, now I am trying to reach 100% test coverage. As you can see in my test class below, i inserted a new contact as coTeacher ...
0
votes
0answers
18 views

Compose a multipart/form-data request from apex [closed]

This is not a question, it is a answer! May base64 encoded request work for you, but sometimes add some blank spaces is not a option so, I cam with this option, use hex to encode the entire request ...
1
vote
0answers
40 views

APEX Test method mystery: String comparison results look identical but APEX Assertion fails test

I am not an apex programmer, but have successfully airbrushed the following working apex code to add one extra field (Account Key) into a displayed string. Results look correct in the field on the ...
0
votes
1answer
28 views

Rest Service - Return grandchild in the response

I need to create a Rest Api where I want to take as input an Id and perform a query on an object. The response must contain the fields of this record and also some related records (children) and the ...
5
votes
1answer
89 views

VS Code extension no longer including line number in Apex test failure output

When I run Apex tests from VS Code (leveraging Salesforce CLI), I'm accustomed to the output telling me what line my tests failed on in the event of failure. I've noticed a recent change (just in the ...
0
votes
1answer
17 views

string comparison with special character

I am trying check below string in the if condition but apparently it is not satisfying the string comparison condition even though system.debug shows the same string. String APH = test.substring(0,3);...
0
votes
1answer
21 views

Apex client-side to server-side constructor

I am currently reading this Salesforce doc: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_returning_data.htm This is the code provided on the page ...
0
votes
1answer
27 views

Auto-Populate phone as formatted

I want my phone field to be auto-populated as below after record is saved. +XX (XXX) XXX-XXXX I've tried regex to format. But, it's working only if I enter a formatted phone number. Can someone help ...
0
votes
1answer
19 views

I get error message “Developer script exception from JobTeaser : 'OmnichannelSyncWebhook' for job id '7072p00008tIjz5' : Argument 1 cannot be null” [closed]

I am facing an issue regarding an error after downloading the Omnichannel Package from Aircall, I get the following error message "Developer script exception from JobTeaser : '...
0
votes
0answers
27 views

Weird Context Behaviour in LWC and Apex

I'm writing a simple 'Merge Lead and Opp' lwc that leverages apex to transfer some custom fields from the lead to the opp before deleting the lead. The apex works fine. The issue is that when the apex ...
0
votes
1answer
17 views

Reference managed package class in target org lightning component

We have a managed package installed in target org/sandbox. We are developing custom code (Lightning aura component) for client. I need to reference the class in managed package as controller for this ...
-1
votes
0answers
35 views

Am having a requirement that I need to accept credit card number and display the billing details for the card number [closed]

Credit card master is having the credit card number but the details of the billing information is present in billing custom object . I wanted to display all the billing details for that credit card ...
0
votes
1answer
14 views

Batch Apex Error - Class must implement the following methods System.ScheduleableContext)

I am trying to update a batch class to allow me to schedule it, but I am getting this error: Class must implement the following methods System.ScheduleableContext I understand the error, but given my ...
0
votes
0answers
33 views

Help with line of Apex code in aura lightning component

I am very new to coding and just need some help on a line of code in the apex for my lightning component. I have created a lightning component on a opportunity record which displays related records in ...
0
votes
1answer
21 views

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

I have a situation where when I make a callout I get a single json response like this: { "Person": { "Infomration": { "IndividualInformation": { ...
0
votes
0answers
25 views

I need to create Autogenerated Sequential Alphanumeric code, where the digits and letters change

We have an ID field, 4 characters that must start with an 8. We are nearing the end of these numbers and would like to update our trigger to make the last character a letter that also rotates. So ...
0
votes
0answers
13 views

List view parameters via URL

Can List view parameters be passed in via the URL in Lightning? Need to create a list view or show related list with multi select option
0
votes
1answer
27 views

Why we can overwrite standard class? [closed]

A user reported an error in Salesforce due to this error: Method does not exist or incorrect signature: isRunningTest I know that this was because someone has created a class by the name Test. I ...
-1
votes
0answers
23 views

<apex:repeat var=“doc” value=“{!relatedTo.Attachments}”> not working

I have the following visualforce email template: <messaging:emailTemplate subject="Unpaid Invoice" recipientType="Contact" relatedToType="Invoice__c"> <...
1
vote
1answer
19 views

HTML table in Lightning using iteration

I have an object 'AccountLineItem' . I have a field 'System' and a boolean field 'isHeader'. I am trying to group by system field where isHeader =true . I have a Map<String,List> .Which I am ...
0
votes
1answer
25 views

Query Accounts: How to query names and ages only [closed]

I am trying to query accounts, but it gives me errors all the time. What is the best way for querying if I only need the names and ages. And what is the way of checking how many accounts I have, using ...
3
votes
1answer
72 views

Can Database.executeBatch be called from a Queueable started by System.enqueueJob?

I'm aware that you can't call Database.executeBatch from the execute method of an already running Batchable. But can Database.executeBatch be called from a Queueable running via System.enqueueJob? I'm ...
0
votes
1answer
32 views

Problem with LWC wire on inner class

I'M creating an inner class "AdobeSummaryModel" with many variables and setting its values on getAdobeSummaryDetails method that will return myModel of "AdobeSummaryModel" type ...

1
2 3 4 5
626