+ Start a Discussion
Ashwath_KAshwath_K 

How to Identify Records from API

I need to write a trigger on Task so that it fires only for the records that are created in the UI.

For the records that get created through Outlook etc. I want to bypass the trigger. 

 

Hw to achieve that logic. Is there any way to identify the records created from API or from UI?

 

Pls let me know ASAP.. Thnx

Rick_NookIndRick_NookInd
I use a different user for system API transactions so I can distinguish... especially in validation rules.  Not sure if there is any other way...
Rajesh ShahRajesh Shah
You can create a hidden field checkbox say Created From API. Whenever you are making any update through API, always check this checkbox. Since the field is hidden, it will not be visible to the users and will never be checked when record is created from UI. This way, you can distinguish whether the record is created from UI or API.
Ashwath_KAshwath_K
Hi thanx for the inputs. But how do u Identify a Record that is coming from API to make it checked. Is it that, We have to make sure all the API transcations check that checkbox. Incase of Outlook should I create a New field and map it to the SF Field to make it checked. I am not sure will it work that way from Outlook. 
Rajesh ShahRajesh Shah
Well yes, that was the way I was looking at ... all Api transactions check that checkbox. And yes, incase of outlook, you would have to map the field. I haven't used outlook so I am not sure of there is any hidden parameter or settings from which you could do that w/o showing the user.