I’m looking to build some logic that saves related items to the database all in the same save action sequence, and rolls back inserts if anything went wrong.
To this end, I’d like to use the SKUID Temporary IDs to relate items together via APEX code, so I can create and relate these things all together with a trigger on insert by querying for the SKUID Temporary ID, and then relate the related objects based on their Salesforce IDs after finding them via the SKUID IDs.
In order for this to work, the SKUID Temporary IDs that get generated would need to be unique not just to the local instance of the page, but also to the entire database. Is this the case? Are SKUID Temporary IDs unique to all other SKUID Temporary IDs ever created, or are they only unique to the local instance of the page? If they are unique only to the local instance of the page, is there any way I could use them to create an ID that is unique to the entire database?
----
Further details of proposed design for context:
I’m inserting an Invoice and Invoice Lines via a wizard where Step 1 is to create the Invoice and Step 2 is to create the Invoice Lines. Normally I’d save the invoice after Step 1 is complete so I can then relate the Invoice Lines to the Salesforce ID of the Invoice, but if I Save Step 1 and then close the wizard (or my browser crashes), I get an “orphan Invoice” where it’s just an invoice that got saved that has no lines on it.
If instead I only saved the Invoice and the Invoice Lines all at the same time and rolled back the save if anything failed, then I won’t have to worry about the possibility of an orphan Invoice, but in order to do this I need to relate the objects together, and can’t get the Salesforce ID of the Invoice until it is saved.
If I can use a unique ID to relate these objects together, (SKUID temporary ID?) and insert the Invoice with a new field (SKID__c) where I populate that field with the unique ID, then when inserting Invoice Lines I populate their Invoice_SKID__c with that temporary ID and in APEX have it find the Invoice Salesforce ID and relate the Invoice Lines to the Invoice via Lookup with the Salesforce ID, I should be able to insert all at the same time and maintain relationships properly.
Question
SKUID Temporary IDs - Unique only locally, or unique for entire (Salesforce) database?
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.