Salesforce Mapping issue

Created on 17 January 2024, 11 months ago
Updated 18 January 2024, 11 months ago

Hi,

Facing this issues while pushing the entities from drupal to salesforce after the drupal 10 Migration.

Queue item
8214
failed
1
times. Exception while pushing entity
commerce_order_item
45723
for salesforce mapping
class_line_item_to_invoice_item
. Client error: `POST
https://env.sandbox.my.salesforce.com/services/data/v52.0/sobjects/Invoi...`
resulted in a `400 Bad Request` response: [{"message":"CMS_InvoiceItem_Trigger: execution of BeforeInsert\n\ncaused by: line 84, column 23: Dependent class is inv (truncated...) [@"message":"CMS_InvoiceItem_Trigger: execution of BeforeInsert\n\ncaused by: line 84, column 23: Dependent class is invalid and needs recompilation:\n Class Utils : Illegal assignment from List to List","errorCode":"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY","fields":[]]Queue item
8227
failed
1
times. Exception while pushing entity
node
34755
for salesforce mapping
class_content_class
. Client error: `POST
https://env.sandbox.my.salesforce.com/services/data/v52.0/sobjects/SFDC_...`
resulted in a `400 Bad Request` response: [{"message":"ClassInstructorImportTrigger: execution of AfterInsert\n\ncaused by: line 84, column 23: Dependent class is (truncated...) [@"message":"ClassInstructorImportTrigger: execution of AfterInsert\n\ncaused by: line 84, column 23: Dependent class is invalid and needs recompilation:\n Class Utils : Illegal assignment from List to List","errorCode":"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY","fields":[]]

πŸ“Œ Task
Status

Active

Version

5.0

Component

salesforce_push.module

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Swathi257
  • πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

    Looks like whatever has changed exposed an unhandled exception in your CMS_InvoiceItem_Trigger apex class.

    I would look into that code for more clues.

  • Posting the code for two triggers.. We were facing the above issues with these triggers

    trigger CMS_InvoiceItem_Trigger on Invoice_Item__c (before insert, before update,
    after insert, after update) {

    String debugName = '--- CMS_InvoiceItem_Trigger ---';

    Utils u = new Utils();
    Invoice i = new Invoice();
    Enrollment e = new Enrollment();

    Boolean isApiAdminUser = u.isApiAdminUserProfile(UserInfo.getProfileId());
    private Boolean sendCmsDebugEmail = new Utils().isDebugCMSTrans(UserInfo.getProfileId());

    if(isApiAdminUser) {
    System.debug(debugName + ' executing....');
    if(trigger.isInsert && trigger.isBefore) {
    System.debug(debugName + ' ATTEMPTING INSERT....');
    i.createInvoiceLineFromCMS(trigger.new);
    }
    if(trigger.isInsert && trigger.isAfter) {

    Invoice_Item__c ii;
    ii= (Invoice_Item__c)trigger.new.get(0);
    //i.debugInvoiceItemRecord(ii, 'After '+debugName+ ' executed and item is inserted.', sendCmsDebugEmail);
    i.debugInvoiceItemRecords(trigger.new, 'After '+debugName+ ' executed and potentally MULTIPLE itemS ARE inserted.', sendCmsDebugEmail);

    //------------- have to link the enrollment obj records to invoice item records here because
    //------------- we don't yet have the invoice item ids in the before trigger
    List invItemsInserted = trigger.new;
    Set invItemIds = new Set();
    Boolean atLeastOneClassExists = false;
    for (Invoice_Item__c invoiceItem : invItemsInserted) {
    if(invoiceItem.Class__c != null) {
    atLeastOneClassExists = true;
    invItemIds.add(invoiceItem.id);
    }
    }
    if(atLeastOneClassExists) {
    i.linkEnrollmentToInvoiceItem(invItemIds);
    }
    //-------------- done linking.

    Invoice__c parentInvoice = i.getInvoice(ii.invoice__c);
    System.debug(debugName + ' re-locking Invoice and updating origin');
    parentInvoice.Status__c = 'Finalized';
    parentInvoice.Origin__c = 'CMS Web Order';
    update parentInvoice;
    }
    }
    }

    trigger ClassInstructorImportTrigger on SFDC_Class__c (after insert) {
    Utils u = new Utils();
    String debugName = '--- ClassInstructorImportTrigger.trigger ---';

    if(!u.isDisableClassInstructorImportTrigger(UserInfo.getProfileId())) {
    System.debug(debugName + ' BEGIN EXECUTING!!!');
    Classes cls = new Classes();
    cls.addClassInstructors(trigger.new);
    System.debug(debugName + ' END EXECUTING!!!');
    }

Production build 0.71.5 2024