• Sara-CASA
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

I'm trying to make the following case statement work:

CASE( Actual_Shipping_Cost__c ,
null, CASE (Shipping_Method__c ,
    "Pick up" , 0, 
    "Media mail", CASE ( Order_Number_of_Items__c,
        1, 3, 
        2, 3,
        3, 3,
        4, 5,
        5, 5,
        6, 5,
        7, 5,
        8, 5,
        9, 5,
        10, 7,
        11, 7,
        12, 7,
        13, 7,
        14, 7,
        15, 7,
        16, 10,
        17, 10,
        18, 10,
        19, 10,
        20, 10,
        21, 10,
        22, 10,
        23, 10,
        24, 10,
        25, 10,
        26, 12,
        27, 12,
        28, 12,
        29, 12,
        30, 12,
        31, 12,
        32, 12,
        33, 12,
        34, 12,
        35, 12,
        (( Order_Weight__c +1 ) * 0.39 ) + 1.99 + 0.8 
        ),
    Actual_Shipping_Cost__c
    ),
Actual_Shipping_Cost__c 
)

 there are no syntax errors, but it always returns 0 when Actual Shipping Cost is null unless I take out a couple of the cases, leaving:

CASE( Order_Number_of_Items__c,
        1, 3, 
        2, 3,
        3, 3,
        4, 5,
        5, 5,
        6, 5,
        7, 5,
        8, 5,
        9, 5,
        10, 7,
        11, 7,
        12, 7,
        13, 7,
        14, 7,
        15, 7,
        16, 10,
        17, 10,
        18, 10,
        19, 10,
        20, 10,
        21, 10,
        22, 10,
        23, 10,
        24, 10,
        25, 10,
        26, 12,
        27, 12,
        28, 12,
        29, 12,
        30, 12,
        31, 12,
        32, 12,
        33, 12,
        34, 12,
        35, 12,
        (( Order_Weight__c +1 ) * 0.39 ) + 1.99 + 0.8 
        ),
 )

 

any thoughts?  i know its kind of complicated, couldn't figure out how to return 12 for 26-35 without listing them all separately, but that part at least works!

 

Thanks!
Sara

I have a tricky workflow that I'm trying to set up.  Basically I have 2 objects (let's call them Master1 and Master 2) that both have master-detail relationships to the same detail object (Detail).  I want a workflow rule to update a field on Master2 based on a value in Detail when a field on Master1 changes.

 

Since Master1 and Master2 don't have a direct relationship between them, I'm not sure how to make this work.  I tried setting up the workflow rule on Detail, since then I could access all the fields, but the field update would never happen because the workflow was looking for an edit to Detail and I was updating Master1.  I tried it with a formula field on Detail to copy the info I want from Master1 and then have that trigger the field update on detail, but unfortunately a formula updating itself doesn't count as an edit, so that didn't work either.

 

Would appreciate any thoughts on how to make this work.

 

Thanks!
Sara

 

 

I'm trying to make the following case statement work:

CASE( Actual_Shipping_Cost__c ,
null, CASE (Shipping_Method__c ,
    "Pick up" , 0, 
    "Media mail", CASE ( Order_Number_of_Items__c,
        1, 3, 
        2, 3,
        3, 3,
        4, 5,
        5, 5,
        6, 5,
        7, 5,
        8, 5,
        9, 5,
        10, 7,
        11, 7,
        12, 7,
        13, 7,
        14, 7,
        15, 7,
        16, 10,
        17, 10,
        18, 10,
        19, 10,
        20, 10,
        21, 10,
        22, 10,
        23, 10,
        24, 10,
        25, 10,
        26, 12,
        27, 12,
        28, 12,
        29, 12,
        30, 12,
        31, 12,
        32, 12,
        33, 12,
        34, 12,
        35, 12,
        (( Order_Weight__c +1 ) * 0.39 ) + 1.99 + 0.8 
        ),
    Actual_Shipping_Cost__c
    ),
Actual_Shipping_Cost__c 
)

 there are no syntax errors, but it always returns 0 when Actual Shipping Cost is null unless I take out a couple of the cases, leaving:

CASE( Order_Number_of_Items__c,
        1, 3, 
        2, 3,
        3, 3,
        4, 5,
        5, 5,
        6, 5,
        7, 5,
        8, 5,
        9, 5,
        10, 7,
        11, 7,
        12, 7,
        13, 7,
        14, 7,
        15, 7,
        16, 10,
        17, 10,
        18, 10,
        19, 10,
        20, 10,
        21, 10,
        22, 10,
        23, 10,
        24, 10,
        25, 10,
        26, 12,
        27, 12,
        28, 12,
        29, 12,
        30, 12,
        31, 12,
        32, 12,
        33, 12,
        34, 12,
        35, 12,
        (( Order_Weight__c +1 ) * 0.39 ) + 1.99 + 0.8 
        ),
 )

 

any thoughts?  i know its kind of complicated, couldn't figure out how to return 12 for 26-35 without listing them all separately, but that part at least works!

 

Thanks!
Sara

I have a tricky workflow that I'm trying to set up.  Basically I have 2 objects (let's call them Master1 and Master 2) that both have master-detail relationships to the same detail object (Detail).  I want a workflow rule to update a field on Master2 based on a value in Detail when a field on Master1 changes.

 

Since Master1 and Master2 don't have a direct relationship between them, I'm not sure how to make this work.  I tried setting up the workflow rule on Detail, since then I could access all the fields, but the field update would never happen because the workflow was looking for an edit to Detail and I was updating Master1.  I tried it with a formula field on Detail to copy the info I want from Master1 and then have that trigger the field update on detail, but unfortunately a formula updating itself doesn't count as an edit, so that didn't work either.

 

Would appreciate any thoughts on how to make this work.

 

Thanks!
Sara

 

 

I have a many-to-many relationship between 2 objects - contracts & headings.  The junction object is called Contract Headings and is the detail side of the 2 master-detail relationships.

 

On the headings object, I have a lookup formula to pull back a category number from a fourth object Heading Category.  I've also put a cross-object formula on the junction object Contract Headings to pull this contract number over from the Heading object.  I realize you cannot use cross-object formula fields in roll-up summaries so to get around this, I created another formula field on the junction object to pull over the value from the cross-object formula field (on junction object) for category. 

 

So to summarize, on the child object in this attempted roll-up, I have a cross-object formula which I cannot use in a roll-up and another formula to give the value in the un-usable cross-object formula...confusing I know.  :)

 

However, when I try to create the roll-up summary field on the contract object to give the MIN category number from the junction object, the field does not show up. 

 

I really need a roll up summary field on the contract object to give the MIN of the category number on the heading object.  Any idea how I can make this work?

I'm trying to create a webform that includes product line items, but haven't been able to figure out how.  Any suggestions?

Hello All,

This feels like kind of a stupid question, but it is driving me nuts. I am using Apex to create a record when another event happens. The record I am creating has a master-detail relationship with campaigns. However, when I try to specify the Campaign, it throws the error.

 
Save error: Field is not writeable: Payments__c.Master_Study__c    Sandbox/src/classes    ProcessCancelRecords.cls    line 27    1247502651652    1952 

 

Below is my code, the line

 Payment.Master_Study__c= r.Master_Campaign__c;

is the one causing the problem. Thats the master detail field I want to populate. I know you cannot modify that field after creation, but these records don't even exist yet, so I don't know why it is freaking out.

 

 

public class ProcessCancelRecords { public static void ProcessCancels (Respondent__c[] respondents) { DateTime dT = System.now(); Date myDate = date.newinstance(dT.year(), dT.month(), dT.day()); list<Payments__c> PaymentsToCreate = new List <Payments__c>(); for (Respondent__c r : respondents) { if(r.Respondent_Status__c == 'Cancelled') { Payments__c Payment = new Payments__c(); Payment.Contact__c = r.Respondent__c; Payment.Contribution_Amount__c = 0.00; Payment.Payment_Amount__c = 0.00; Payment.RespondentRecord__c = r.Id; Payment.Status__c = 'Cancelled'; Payment.Study__c = r.Child_Campaign__c; Payment.Host__c = 'Auto Create From Rule'; Payment.Notes__c = 'This was automatically Created when this respondent cancelled'; Payment.Payment_Received_Date__c = myDate; //Apperantly you cannot specify the master detail relationship field even //though this is a new record. I know you cannot modify the master detail after //the fact, but you cannot even specify it before creation. Weird. //Payment.Master_Study__c= r.Master_Campaign__c; PaymentsToCreate.add(Payment); } } insert PaymentsToCreate; } }