When are values Deleted and Re-Created in the sys_choice table?

G24
Kilo Sage

Apparently under some circumstances values in the sys_choice table are deleted and then re-created with different sys_id values.  This happens automatically, behind the scenes.  But I don't know what triggers it.  (This is a problem for me because I created an M2M table that points to the sys_choice table.)

 

Can someone please clearly explain exactly when this happens?  What steps can I take to see these values get deleted and then re-created?  Or if documented, where can I read about this behavior?  Thank you!!

5 REPLIES 5

VikMach
Mega Sage

@G24 - Hi Geoffrey,
Personally I have never come across this situation but if you don't see the deleted activities in logs or anywhere else in the system OR not able to trace at all. I would suggest create a Before Delete Business rule and trigger an email to yourself (or some place you can see the deleted activity logs) or update some KB to list out what action(s) behind the scenes is performing that activity.

 

On a side note though, once I came across some scheduled transform map performing irrelevant create activities. See if your instance has some of those scheduled activities on sys_choice table from Transform Map table or Scheduled Jobs record.

Let me know if that helps.

Thanks,
Vikas K

I think I could setup a Before Delete business rule and trigger a notification.  That's a good idea.  But how would I communicate the "CONTEXT" of the deletion?

 

Is there some way to capture the "Call Stack" / Context within script?  So I can be sent to a log / email?

You could try something like below.

	// Capture details of the deleted record
    var deletedRecordDetails = "A record in the sys_choice table was deleted.\n";
    deletedRecordDetails += "Choice Table: " + current.getValue("name") + "\n";
    deletedRecordDetails += "Choice Value: " + current.getValue("value") + "\n";
    deletedRecordDetails += "Choice Label: " + current.getValue("label") + "\n";
    deletedRecordDetails += "Deleted By: " + gs.getUserDisplayName() + "\n"; // User who deleted the record
	var callStack = new Error().stack;
	deletedRecordDetails += "Call Stack : " + callStack;

    // Log the information to system logs
    gs.log("Sys Choice Deletion Info  : " + deletedRecordDetails, "SysChoiceDeletionLogger"); // gs.log takes 2nd param text of your choice. This will show in Source field of syslog table. Helps to quick filter
	gs.log("Deleted Call Stack : " + callStack);

@VikMach You are a gentleman and a scholar, Sir.  Thank you very much!