• RayAllen
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 16
    Replies
Hi,

I'm working on converting our workflow rules to Processes and Flows so that they can be better consolidated and followed by the business.  I am running into the "Unhandled Error" message due to validation rules that are in place.  So, I'd like to determine the "errors" in my flows, and then pass the information into an apex class that will display the message that I use in my validation rules.

I feel as though I am close, but I'm unsure of how to access the invocable variables within the invocable method.  I get an error message on the last line of code when compiling, and am not sure how to accomplish my desired result.  I am pretty new to apex, so any guidance would be much appreciated.  Code and error message below.

Apex Class
public class OpportunityErrorHandling{
   
    // Get variables from flow/process
    public class varList {
        @InvocableVariable(label='Error Message' required=true)
        public String errorMessage;
        @InvocableVariable(label='Opportunity' required=true)
        public Opportunity opp;
    }
   
    // Add error
    @InvocableMethod(
        label='Adds an error to the record'
        description='Will display an error message to the page instead of the unhandled exception error')
    public static void addErrorMessage(List<varList> variables) {
        // Present error message to user
        variables.opp.addError(variables.errorMessage);
    }
}

Error Message
Error: Compile Error: Initial term of field expression must be a concrete SObject: List<OpportunityErrorHandling.varList> at line 17 column 9

Thank you,

Justin

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code. Also, I would want it to be fully automated.

 

How can I write the formula for this?

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

Hi,

 

Our users will be attaching documents to accounts periodically.  Upon attachment, I need a field ('review_needed' -  a checkbox) to be changed to either checked or unchecked (doesn't matter, just needs to be modified). 

 

How can I achieve this using a trigger?  Is it possible to change the field using a workflow upon attachment (I'm guessing no).

 

Thanks in advance for any help you can provide!!!

Hi,

 

I would like to send out an email alert anytime anyone has added an attachment to an Account.  I found the below code on here, but it is specific to an opportunity.  Could anyhelp me modify it to work for an Account?  I tried changing the obvious (opportunity -> account), but I am not having success.  I have created the field 'review_needed' in Accounts in order to match the below code.

 

Any other hints to help me in this endeavor would be greatly appreciated!

 

Thanks!

 

Code:

}

trigger Attachment_Processor on Attachment (after insert) {

map<id, opportunity> opps = new map<id, opportunity>();
Opportunity o = null;

for(attachment a:[select parentid from attachment where parent.type = 'Opportunity' and id in :trigger.keyset()]){

o = new Opportunity(Id = a.parentid, review_needed__c = true);
opps.put(a.parentid, o);

}

update opps.values();
 
Hi,

I'm working on converting our workflow rules to Processes and Flows so that they can be better consolidated and followed by the business.  I am running into the "Unhandled Error" message due to validation rules that are in place.  So, I'd like to determine the "errors" in my flows, and then pass the information into an apex class that will display the message that I use in my validation rules.

I feel as though I am close, but I'm unsure of how to access the invocable variables within the invocable method.  I get an error message on the last line of code when compiling, and am not sure how to accomplish my desired result.  I am pretty new to apex, so any guidance would be much appreciated.  Code and error message below.

Apex Class
public class OpportunityErrorHandling{
   
    // Get variables from flow/process
    public class varList {
        @InvocableVariable(label='Error Message' required=true)
        public String errorMessage;
        @InvocableVariable(label='Opportunity' required=true)
        public Opportunity opp;
    }
   
    // Add error
    @InvocableMethod(
        label='Adds an error to the record'
        description='Will display an error message to the page instead of the unhandled exception error')
    public static void addErrorMessage(List<varList> variables) {
        // Present error message to user
        variables.opp.addError(variables.errorMessage);
    }
}

Error Message
Error: Compile Error: Initial term of field expression must be a concrete SObject: List<OpportunityErrorHandling.varList> at line 17 column 9

Thank you,

Justin
Hi all,

I am running into the CPU time limit exceeded error when I try to bulk import data into our org. Because I don't have coding knowledge myself, I was hoping to use visual workflows instead. The data that we sync has up to 22 fields that have 0's and 1's for the field input and I want to change these into "Yes" and "No" picklist values. The reason that I didn't want to use a formula field is because sometimes we also manually create records and I wanted to be able to choose Yes/No values. I also couldn't use checkboxes as per the instructions I received. 

Here is process flow I created

User-added image

What I did is I created 22 action groups for each of the binary fields. The action group criteria was to check if the picklist value is a 0 or 1 and if so, it'll kick in the immediate actions.

Here is part of the error message I received below. It seems like it's running but it's just slow..? 
Flow Details
Flow Name: Listing_Workflow_for_Binary_Fields
Type: Workflow
Version: 3
Status: Active

Flow Interview Details
Interview Label: Listing_Workflow_for_Binary_Fields-3_pba__Listing__c
Current User: Keith Kiefer (005150000066qU6)
Start time: 1/22/2017 4:13 PM
Duration: 17 seconds

How the Interview Started
Keith Kiefer (005150000066qU6) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = a091500001MLez0AAD
RecursiveCountVariable = 0.00

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "1/22/2017 4:13 PM"

DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!formula_myRule_1} (true) Equals true
Logic: All conditions must be true (AND)

DECISION: myRule_1_pmetdec
Executed this outcome: myRule_1_pmetnullrule
Outcome conditions: or
1. {!myVariable_old} (null) Is null true
Logic: One condition must be true (OR)

RECORD UPDATE: myRule_1_A1
Find all pba__Listing__c records where:
AssessmentsYN__c Equals 1
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AssessmentsYN__c = Yes
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_1_A2
Find all pba__Listing__c records where:
AssessmentsYN__c Equals 0
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AssessmentsYN__c = No
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

DECISION: myDecision2
Executed this outcome: myRule_3
Outcome conditions: and
1. {!formula_myRule_3} (true) Equals true
Logic: All conditions must be true (AND)

DECISION: myRule_3_pmetdec
Executed this outcome: myRule_3_pmetnullrule
Outcome conditions: or
1. {!myVariable_old} (null) Is null true
Logic: One condition must be true (OR)

RECORD UPDATE: myRule_3_A1
Find all pba__Listing__c records where:
AuctionYN__c Equals 1
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AuctionYN__c = Yes
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

RECORD UPDATE: myRule_3_A2
Find all pba__Listing__c records where:
AuctionYN__c Equals 0
Id Equals {!myVariable_current.Id} (a091500001MLez0AAD)
Update the records’ field values.
AuctionYN__c = No
Result
All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes.

I had a few questions regarding how the process builder operates I was hoping one of you could help me understand

1) Is there a difference between the criteria for the action group and the criteria for the immediate action? Since the flow evaluates all the actions regardless, I'm not sure if this makes much of a difference. 
2) Does flow recursion significantly increase the CPU time?
3) I was also thinking of making parallel PB flows to make the workflow look more organized on the back end. Is that okay or would it just cause more problems for me in the long run?

Thanks for reading. I might be missing a few pieces due to a lack of coding knowledge so any insight would be greatly appreciated!
Hi,

I'm working on converting our workflow rules to Processes and Flows so that they can be better consolidated and followed by the business.  I am running into the "Unhandled Error" message due to validation rules that are in place.  So, I'd like to determine the "errors" in my flows, and then pass the information into an apex class that will display the message that I use in my validation rules.

I feel as though I am close, but I'm unsure of how to access the invocable variables within the invocable method.  I get an error message on the last line of code when compiling, and am not sure how to accomplish my desired result.  I am pretty new to apex, so any guidance would be much appreciated.  Code and error message below.

Apex Class
public class OpportunityErrorHandling{
   
    // Get variables from flow/process
    public class varList {
        @InvocableVariable(label='Error Message' required=true)
        public String errorMessage;
        @InvocableVariable(label='Opportunity' required=true)
        public Opportunity opp;
    }
   
    // Add error
    @InvocableMethod(
        label='Adds an error to the record'
        description='Will display an error message to the page instead of the unhandled exception error')
    public static void addErrorMessage(List<varList> variables) {
        // Present error message to user
        variables.opp.addError(variables.errorMessage);
    }
}

Error Message
Error: Compile Error: Initial term of field expression must be a concrete SObject: List<OpportunityErrorHandling.varList> at line 17 column 9

Thank you,

Justin

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

Hi,

 

Our users will be attaching documents to accounts periodically.  Upon attachment, I need a field ('review_needed' -  a checkbox) to be changed to either checked or unchecked (doesn't matter, just needs to be modified). 

 

How can I achieve this using a trigger?  Is it possible to change the field using a workflow upon attachment (I'm guessing no).

 

Thanks in advance for any help you can provide!!!

Hi,

 

I would like to send out an email alert anytime anyone has added an attachment to an Account.  I found the below code on here, but it is specific to an opportunity.  Could anyhelp me modify it to work for an Account?  I tried changing the obvious (opportunity -> account), but I am not having success.  I have created the field 'review_needed' in Accounts in order to match the below code.

 

Any other hints to help me in this endeavor would be greatly appreciated!

 

Thanks!

 

Code:

}

trigger Attachment_Processor on Attachment (after insert) {

map<id, opportunity> opps = new map<id, opportunity>();
Opportunity o = null;

for(attachment a:[select parentid from attachment where parent.type = 'Opportunity' and id in :trigger.keyset()]){

o = new Opportunity(Id = a.parentid, review_needed__c = true);
opps.put(a.parentid, o);

}

update opps.values();