+ Start a Discussion
Vershley JoyejobVershley Joyejob 

Enable a method only when using dataloader

When I create or modify an Account using the UI, nothing should happen. Then I clicked on a custom button on the Account page layout, this sends the modified Account to a WebService.
But when creating or moddifying Accounts in bulk using dataloader, all the accounts should be sent to the WebService.

What are the best ways we could do this ?
NOTE: The Account should only be sent when clicked on the button when using the UI.

Thanks for your ideas.
James LoghryJames Loghry
There's no context variable / awareness in Apex that says "hey, I'm running because of Dataloader"  At least, that I know of.  However, one option would be to create a user record that is solely for Dataloader, and have all the dataloads run under that user (then you could check the trigger against UserInfo.getId()).  Another option would be to create a custom field on the Account record that says something to the effect of "last updated by data loader on" and then check that against your trigger.  They're both pretty hacky, but should do the trick