6

Is there a list or a way to determine what objects are available for triggers?

I'm looking at writing one on PermissionSetAssignment. I looked up the properties on workbench and didn't see anything that resembled triggerable, and Googling this was not fruitful. I suppose I could try writing one and see what happens, but that seems rather crude.

permissions set assignment properties in workbench

1

3 Answers 3

7

Workbench, as you appear to have been using, was the correct tool. The fact that permission set didn't show as triggerable told you what you needed to know. Unfortunately, that's the behavior of how Workbench works. Below, you'll see a screen capture from Workbench looking at User which is triggerable. Workbench only shows the information if an object supports triggers and omits it if it doesn't.

Workbench Screen Capture

1
  • Thanks I had just made up the word triggerable...didn't realize it existed and would not show up if false.
    – gorav
    Feb 14, 2016 at 19:23
1

Apex has a class called Schema. It renders the entire list of objects of your org, including fields, field type etc. The Apex class:

<apex:page controller="objectList" >
  <apex:form >
    <apex:SelectList value="{!val}" size="1">
      <apex:selectOptions value="{!Name}"></apex:selectOptions> 
    </apex:SelectList>
  </apex:form>
</apex:page>

The Visualforce page:

public class objectList{
  public String val {get;set;}

  public List<SelectOption> getName()
  {
    List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();     
    List<SelectOption> options = new List<SelectOption>();

    for(Schema.SObjectType f : gd)
    {
       options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
    }
    return options;
   }
}
0

If you are using Eclipse IDE then there is one way. When you select new ApexTrigger it will give you all available object on which you can create trigger.

Also i am not sure but you can try metadata and Tooling Api may be they will give you option.

Last option is store all Standard object in a Custom Setting in which you can create trigger because you can create trigger on every custom object. but eclipse IDE will come handy in your case.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .