« first day (616 days earlier)      last day (393 days later) » 

2:24 PM
Hello
 
 
2 hours later…
4:53 PM
@user320 which one was that?
@geekymartian Hi
 
 
1 hour later…
6:13 PM
Hi guys
I've already asked this in the site but maybe somebody has any idea here as well. I got this exception while inserting account share records:
DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>
the unknown thingie is driving me crazy
:P
 
 
1 hour later…
7:31 PM
Sharing insert will fail if you'll attempt to insert a row with same "meaning" (ParentId, UserOrGroupId, RowCause) more than once.

The most hassle-free way to deal with it is to use `Database.insert(myRows, false);` ;)

The more proper way would be to build a `Map<String, AccountShare>` where string is a composite key of these 3 values and when you're ready - `insert myMap.values();`. But it's a waste of script statements if the platform already does this check for you... plus what if you'll clash with existing old record, you'd be safest using `Database` version again.
Regular users see "unknown" when they aren't allowed to see the clashing record (unique field on Account you can't see but the platform has to somehow stop you from inserting the duplicate)... not sure how this applies to sharing or the fact you probably have "view all data".
Last time I've had it we encountered some weird screw up in profiles deployed with Eclipse IDE - the field didn't make it to the production but the relevant entry in profile went in and was complaining when we tried to add the field - same error, duplicate unknown on record with id unknown... We ended up deleting the object for a while I think...
 
 
1 hour later…
9:00 PM
Thanks @eyescream
I've been tracking the bug and found that there are 2 batches trying to insert the same share at the same time.
 
Do both fail or only one? Interesting... then the whole sharing thing is bit of magic, I think SF patented it
 
14:52:50.033 (33682996)|CODE_UNIT_STARTED|[EXTERNAL]|01pA0000001eO8A|EntitlementBatch_SalesRelationships
14:52:51.024 (24524845)|CODE_UNIT_STARTED|[EXTERNAL]|01pA0000001eO8A|EntitlementBatch_SalesRelationships
the one at 52:51 fails
14:52:51.077 (1077267555)|USER_DEBUG|[1852]|DEBUG|INSERTING 1 APEX SHARES - ACCOUNT
14:52:51.077 (1077270549)|SYSTEM_METHOD_EXIT|[1852]|System.debug(ANY)
14:52:51.077 (1077302749)|DML_BEGIN|[1854]|Op:Insert|Type:AccountShare|Rows:1
14:52:51.110 (1110743449)|DML_END|[1854]
14:52:51.473 (473656998)|DML_BEGIN|[1854]|Op:Insert|Type:AccountShare|Rows:1
14:52:51.920 (920373863)|DML_END|[1854]
14:52:51.920 (920497193)|EXCEPTION_THROWN|[1854]|System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>
 
Are these really different batch jobs (diff job id when viewed in Job Logs for example) or separate calls of the execute()?
 
different logs
 
it doesn't matter much really... you should be still able to solve it with "insert what you can" approach
 
9:08 PM
yes , the share is inserted
one of those win
I was curious about the unknown
I
'll add the datbase.insert(recs,false) just in case
thanks again
 
no probs :)
 

« first day (616 days earlier)      last day (393 days later) »