Skip to main content

Hi Guys

 

I have been creating a new custom object in Salesforce I have built my object and have got it to run as desired for now, I am wondering if there is a formula that can help me with a field update section to save me creating 52 workflow rules I would rather create 52 field up dates if possible J

 

What needs to happen is

 

If when my workflow is triggered the field update needs to do the following

 

Update the selected field with a value from a formula field so that relates to the selected week

 

So if my custom field  At_Risk_Week has a value of 2 in it then update my field week_2

 

With the value of what is in my field called AT_RISK_SCORE

 

Hope this makes sense :S I will have to do this with other field updates for each week,

 

I can get it to work I think by using 52 workflow rules but I am wondering if there is an easier way of achieving this,

 

Also I have another way that I might be able to achieve this whole process by creating a parent child an creating another object and using roll up summaries but I want to get one version working before I start another any tips or advice would be greatly appreciated :)

 

Thanks

 

James

 

Field update trouble with a formula :S
6 个回答
  1. 2011年8月18日 12:58

    James,

    I think you may find a few issues as you begin to scale this solution as you have it designed.

    1. You cannot selectively execute a particular Workflow Action related to a single Workflow Rule. This means, they all execute or none execute (depending on if the rule’s criteria are met or not). Therefore, you can’t have one rule with 52 Field Update Actions and have only a particular Action execute (e.g. only fire the Week 2 update this time and the Week 5 rule next time).
    2. You can only have a maximum of 40 immediate Actions related to a rule, with a limit of 10 Field updates per rule.
    3. You can only have a maximum of 50 active Workflow Rules related to an object. See the Help & Training article titled: "Salesforce Editions and Limits" for more info

    I think what Varun was suggesting was that your best course of action here will probably be Apex code. A trigger that will run after update/after insert (meaning after the system has committed the creation of a new record or the update of an existing record, the trigger would then run).

    Architecturally, you’re probably better off (as you suggested) going to a related object to store the week-by-week scores. Not possible with workflow, but easy with Apex.

    I know that’s probably not what you wanted to hear, but if I understand the requirement properly, Apex is going to be your best avenue to solve for this. 

    ALL THAT SAID:

    I think you could get away with six Workflow rules and 52 Actions… I would not recommend this as it is poor architecture, inefficient, and makes my technical teeth hurt, but I believe it could work for you.

    Rule 1 would run if the At Risk Week was equal to 1,2,3,4,5,6,7,8,9,10

    Action 1 would be a field update to Week 1 using a formula:

      IF(At_Risk_Week__c = 1, At_Risk_Score__c, Week_1__c)

    This will mean that if it is week 1, the Week  1 field will be changed to the At Risk Score, otherwise it will overwrite with itself, meaning no change.

    Repeat the Actions for weeks 2 – 52 incrementing the week number and field names then assign to rules in groups of 10 until you run out...

0/9000