You need to sign in to do that
Don't have an account?
Angela Skenderi 2
private static Pay_Element__c createEarningsAttachmentPayElement(
Earnings_Attachment__c earningsAttachment,
Decimal deductionAmount,
Id ppsId,
IncomeModifierService.Settings earningsAttachmentSettings
) {
String aeoName = buildEarningsAttachmentName(earningsAttachment);
Decimal deductionAmountAndAdminCost = EarningsAttachmentCalculator.addAdminCosts(
earningsAttachment,
deductionAmount
);
Id payElementTypeId = earningsAttachment.PayElement.Earning_Attachment_Pay_Element_Type__c;
return PayElementService.createPayElement(
aeoName,
ppsId,
deductionAmountAndAdminCost,
payElementTypeId,
earningsAttachmentSettings
);
"Variable does not exist: PayElement" is the error that I have regarding this code, what would be a good solution? (Would also appreciate explanations as well)
private static Pay_Element__c createEarningsAttachmentPayElement(
Earnings_Attachment__c earningsAttachment,
Decimal deductionAmount,
Id ppsId,
IncomeModifierService.Settings earningsAttachmentSettings
) {
String aeoName = buildEarningsAttachmentName(earningsAttachment);
Decimal deductionAmountAndAdminCost = EarningsAttachmentCalculator.addAdminCosts(
earningsAttachment,
deductionAmount
);
Id payElementTypeId = earningsAttachment.PayElement.Earning_Attachment_Pay_Element_Type__c;
return PayElementService.createPayElement(
aeoName,
ppsId,
deductionAmountAndAdminCost,
payElementTypeId,
earningsAttachmentSettings
);
The error "Variable does not exist: PayElement" indicates that Salesforce cannot find a variable or object with the name PayElement in the context where this code is being executed.
In your code, it looks like you're trying to access the PayElement object or variable, but it's not declared or instantiated.
Example
of how you might structure the code with a declaration of the PayElement variable:
Important Update - what you need to do
As a reminder, on December 4, 2023 the Salesforce Discussion Forums will be removed from the Salesforce Developers website. These forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform.
During the week starting November 20, you can view discussions, but not post new questions or responses. On December 4, you will no longer be able to access the discussion forums from the Salesforce Developers website.
Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
- If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
- If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & supportWe know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can get training videos, information, and assistance.
We are here to help you through this transition!
Sincerely,
The Forums Support Team