Announcement

Collapse
No announcement yet.

Salesforce Object insertion order

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CnP.Support
    replied
    Good day!

    As requested we changed the trigger order per Release 3.13.

    Please see the release notes: Release 3.13: Campaign Update and Recurring Listing with Transactions

    Leave a comment:


  • CnP.Support
    replied
    Good day!

    Sorry for a bit of late reply. Our developers looked into this and we finally realized what is going on.

    We tested the code against our new release (not yet released) and you were testing it against the 3.11 release (latest release). The order has changed to what you were asking for and is different from the 3.11 release as you have.

    So the short answer is YES - the code will do exactly as you are describing when it is released. The ETA is first week of August. The new release will also have complete customizable mapping of posted fields with all the fields in Accounts and Contacts. The new feature will add a great deal of flexibility for those clients that have customizations with mandatory fields.

    Leave a comment:


  • sum3
    replied
    hi,

    i'm interested in any update you can give me on your thinking. i think insertion of the custom questions before the opportunity would be best for all your users, i can give some supporting arguments if you don't already agree.

    but, if you're not going to change the insertion order, i can change my code to work with them inserted after the opportunity. it will be a little less efficient overall, but it will work.

    i wouldn't want to change the code if you're going to change the custom question insertion order sometime soon, just to have it break and then need to change it back. so, any information you have on if/when you might make a change, or if my analysis on insertion order was flawed, would be much appreciated.

    thanks!

    Leave a comment:


  • sum3
    replied
    Thanks for taking the time to research that and post the order here for the benefit of all.

    After adding some more testing code, I was still experiencing the same problem. So, I finally added some debugging code. I added a trigger that is run when the custom questions are inserted that saves the system time in milliseconds. Then I also saved the system time from the trigger for the opportunity insertion. I found that the custom questions were inserted 2 seconds AFTER the opportunity record.

    For order 1171521558145420, you can find in the oppportunity record under the 'Dedication Personal Note' field a value with "t: 1310778368448", that's the system time in milliseconds. If you look at the CnP Custom Questions you'll see in a new field, "CORAL debug" a value with "t: 1310778370481". This is about 2 seconds later.

    Here's the custom question trigger, fyi:

    trigger CnPCustomQuestion on CnP__Custom_Question__c (before insert) {
    CnP__Custom_Question__c[] questions = Trigger.new;
    for (CnP__Custom_Question__c question:questions) {
    question.CORAL_debug__c = question.Name + ', s: ' + questions.size() +
    ', t: ' + System.currentTimeMillis();
    }
    }


    Similar code is in the opportunity trigger.



    I did verify, by the way, that the C&P Recurring transaction is inserted before the opportunity, that's working great.


    Thanks.

    Leave a comment:


  • CnP.Support
    replied
    Good day!

    Sorry for a bit of delay in answering this. We had to research this to make sure.

    Our developers have checked the code and here is the order that we update:
    1. Contact
    2. Account
    3. Transaction
    4. Recurring
    5. Custom Question
    6. Opportunity
    7. Household
    We have double checked your code in our instance and the result is as we expect it.

    Leave a comment:


  • sum3
    replied
    Thanks for the reponse, and I hate to ask, but are you sure? Can you have someone check the code? For some apex code I wrote, if I run it for a C&P Transaction posted last week, the code is able to access the Custom Questions. But when the code runs on a trigger as the Opportunity is inserted, the Custom Questions aren't accessible.

    Sorry I wasn't clear about C&P Recurring objects. I'm curious whether that object is inserted before or after the Opportunity. Again, it'd be great if someone could verify in your code.


    here's the code i'm using to extract the custom questions:

    Map<Id, CnP__CnP_Transaction__c> transMap = new Map<Id, CnP__CnP_Transaction__c>();

    for (Opportunity gift:gifts) transMap.put(gift.CnP__CnP_OrderNumber__c, null);
    transMap = new Map<Id, CnP__CnP_Transaction__c>(
    [select Id, Name, CnP__TotalCharged__c, CnP__Charge_Amount__c,
    CnP__PaymentType__c, CnP__Check_Number__c
    from CnP__CnP_Transaction__c
    where Id in :transMap.keySet()]);
    for (CnP__CnP_Transaction__c trans:transMap.values()) orderNos.add(trans.Name);
    questions = new List<CnP__Custom_Question__c>(
    [select Id, Name, CnP__Custom_Question__c, CnP__Answer__c from CnP__Custom_Question__c
    where Name in : orderNos]);


    again, this code works great for existing transactions entered in past weeks. running it on a Opportunity insert trigger yields questions.size() == 0.

    [note that the last select statement doesn't really have a space between the colon and orderNos, i added it to prevent the : o being turned into a smiley, ]
    Last edited by sum3; 07-15-2011, 05:02 AM.

    Leave a comment:


  • CnP.Support
    replied
    Good day!

    In Salesforce we post Custom Questions BEFORE the opportunity.

    The recurring object does not have custom question so the order does not apply.

    Leave a comment:


  • sum3
    replied
    same question for C&P Recurring objects

    Leave a comment:


  • sum3
    started a topic Salesforce Object insertion order

    Salesforce Object insertion order

    Could you please outline the order in which objects are inserted into the salesforce database when a transaction is processed?

    Specifically, I'm curious whether the Custom Questions are inserted before or after the Opportunity.

    And, if they are inserted after (as my tests seem to indicate), would be possible to insert them before? It would be nice if all C&P objects are inserted before the Opportunity is inserted. That way, we can do any processing needed in one step when the Opportunity is inserted.

    Thanks
Working...
X