added 202 characters in body
Source Link
Saariko
  • 5.4k
  • 12
  • 62
  • 139

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here


I added a debug print, just before the insert oppNew enter image description here Looks like the 'Account Category' exists.



I think the error is that the 'After Insert' Flow - does not recognize the Account object. Even that the account was created before.

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here


I added a debug print, just before the insert oppNew enter image description here Looks like the 'Account Category' exists.

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here


I added a debug print, just before the insert oppNew enter image description here Looks like the 'Account Category' exists.



I think the error is that the 'After Insert' Flow - does not recognize the Account object. Even that the account was created before.

added 207 characters in body
Source Link
Saariko
  • 5.4k
  • 12
  • 62
  • 139

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here


I added a debug print, just before the insert oppNew enter image description here Looks like the 'Account Category' exists.

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here


I added a debug print, just before the insert oppNew enter image description here Looks like the 'Account Category' exists.

added 167 characters in body
Source Link
Saariko
  • 5.4k
  • 12
  • 62
  • 139

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

I have an after insert flow that fires on opportunity. enter image description here

I have a test class that needs to create an opportunity.

    public static Account CreateAccount (){
    Account newAcc = new Account ();
    newAcc.name = 'Test Account Name';
    newAcc.BillingCountry = 'United States';
    newAcc.Industry = 'Finance';
    newAcc.Account_Category__c = 'Commercial';
    insert newAcc;
    system.debug('newAcc.id:: ' + newAcc.Id);
    return newAcc;
}

And Also a CreateOpportunity

    public static Opportunity CreateOpportunity(){
    Account newAcc = CreateAccount();
    Opportunity oppNew = new Opportunity();
    oppNew.RecordTypeId = '0124H000000seDZQAY';
    oppNew.Name = 'Test Opp';
    oppNew.CloseDate = System.now().date();
    oppNew.StageName = 'New';
    oppNew.account = newAcc;
    insert oppNew;
    return oppNew;
}

However, when the test class is executed, I get an error on the testmethod:

13:27:28:404 EXCEPTION_THROWN [52]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “After Insert - Opportunity” process failed. Give your Salesforce admin these details. An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.: []

The log shows the following error, mentioning that the field: Account_Category__c is not set. But it exists in the create record:

13:27:28:396 FLOW_ELEMENT_ERROR The flow failed to access the value for Get_Account_Category_from_Account.Account_Category__c because it hasn't been set or assigned.|FlowDecision|No_Account_Category_For_Errors

The Account insert is successful, as shown in the log entry:

16:41:13:052 USER_DEBUG [32]|DEBUG|newAcc.id:: 0017E00001DY8XZQA1

Being around computers for many years:: Where's my mistake? What's wrong with the flow of data in this scenario?

Tried as in the suggested edit: Error: Illegal assignment from Id to Account enter image description here

Source Link
Saariko
  • 5.4k
  • 12
  • 62
  • 139
Loading