function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iKnowSFDCiKnowSFDC 

Trigger working inside the UI, but not on a VisualForce page

I have a trigger that creates a lead record from a custom object record that meets the criteria.  The trigger works fine if I insert the custom object record via the standard user interface.  If I try to insert the record via a VF page, the trigger fails with an Invalid Parameter error.  

 

When I look at the debug logs, it's capturing the information on the vf page, but when it inserts, it's failing. I can't tell if it's failing on insert of the custom object record or the   

 

If I turn the trigger off, I can insert the custom object record via the VF page, if I turn it back on, it fails.  

 

I'm completely confused by this.  Any ideas?  I went through all of through all of the fields to be sure they matched in type and size because I couldn't think of anything I could troubleshoot?  

 

 

Best Answer chosen by Admin (Salesforce Developers) 
iKnowSFDCiKnowSFDC

The issued ended up being that the trigger was executing based on input from a sites page trying to update a standard object in salesforce.  I have since learned that you cannot edit standard objects via a sites page unless you are using a salesforce portal solution.

All Answers

craigmhcraigmh

Are you missing required fields when inserting on the VF page?

iKnowSFDCiKnowSFDC

Nope - that was the first thing I checked. 

RonakPatel.ceRonakPatel.ce

hi

Can u share the code or error which you got ?

Howler MonkeyHowler Monkey

This sounds like a Profile permissions issue. 

 

Can you share a little bit more about the use case for the VF page?  Are you using it in a Sites application? 

iKnowSFDCiKnowSFDC

The issued ended up being that the trigger was executing based on input from a sites page trying to update a standard object in salesforce.  I have since learned that you cannot edit standard objects via a sites page unless you are using a salesforce portal solution.

This was selected as the best answer