Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Friday, November 25, 2011

Using IsPersonAccount Field in Account Triggers

Great news! It looks like the IsPersonAccount field is always available for use in Apex triggers, without the need to retrieve the field values using SOQL!

The following test was used to reach this conclusion (in Winter '12):
  1. Create a trigger that activates or fires before/after insert, before/after update and before/after delete.
  2. Add code to the trigger to check every record in Trigger.new and in Trigger.old with the following assertion: System.assert(accountInTrigger.get('ispersonaccount') != null);
  3. Create a test method to insert, update and then delete an Account.
  4. Verify that the test passes.

Optionally, one can also use the following code in the trigger to take a deeper look at the basic information that's always available, depending on what caused the trigger to fire:
System.debug('Trigger.new = ' + Trigger.new);
System.debug('Trigger.old = ' + Trigger.old);

Tuesday, May 17, 2011

Mass Deleting Picklist Values

Apparently, the only way one can (relatively) easily mass delete picklist values is by editing the object definition in the Force.com IDE.

To do this:
  1. Open the object definition (e.g., Contact.object).
  2. Delete the picklistValues elements that are no longer desired.

I had to prune a list of 485 picklist values in a language selection picklist to a more reasonable number.

Regardless of this workaround, it would be great if this feature was more easily accessible through the web UI, as per the following idea: "mass delete picklist values (setup)"


Apparently, all I succeeded in doing was shifting the order of the picklist values. At this point I am also at a loss as to how to mass delete picklist values, much to my chagrin.

However, I did eventually create a "sort of" workaround: "JavaScript Hack to Mass Delete Custom Picklist Values"

Tuesday, January 4, 2011

Deleting Characters (a.k.a. Backspacing) through SSH in PuTTY

I've been annoyed consistently by a quirk with SSH, PuTTY, Unix and sudo where pressing the backspace character prints a ^? on the terminal instead of deleting the previous character. Then, to my amazement today, I stumbled upon a way to delete characters through SSH in PuTTY without messing with any terminal configurations!

To delete characters, all one has to do is press either...
  • Shift+Backspace; or
  • Right Arrow
I assume this works with Terminal in Mac OS X or Linux as well, but I have not yet tried. Gone are the days now when I have to retype a 80+ character command just because of a single, silly typo...