You need to sign in to do that
Don't have an account?
jgradw2
Problem with URLFOR using custom objects
Hello! I am looking through the forums and can only find questions about using URLFOR and the "new" action on a custom object. But what about using "edit" or "delete"? For example, I would like to do the following:
<Apex:commandLink action="{!URLFOR($Action.someObject__c.delete, objectID)}" value="Delete" />
or exchange "delete" for "edit". But whenever I do this, I get the error:
"Visualforce Error
Invalid parameter for function URLFOR"
Is there any solution or explanation? Thank you in advance :)
Thank you very much! I have figured out my problem. My action commands were directed to the wrong custom object. However, with the delete action, it will direct to the page that has just been deleted! So I will look into a way to re-direct back to the page it was on. Thank you!
All Answers
I dont think there is a Global Action variable for edit and delete.
But for edit may be you can try this out.
<apex:outputlink value="/{!record.id}/e?retURL={!returnurl}"> edit record </apex:outputlink>
where record is your record and the returnurl id the page you want to navigate to once save is complete. Returnurl can be any VF pages or simply pass the id of the rcord if you want to return back to detail page of the record or else you can leave it blank as value="/{!record.id}/e" .
For delete you may have to write a controller action function.
Big V
Thank you very much for your help! To answer your uncertainty, there are global action edit and delete variables. However, I don't think I've done something right... maybe my custom objects need a visualforce page first? Because the URL just does not work...
Thank you very much! I have figured out my problem. My action commands were directed to the wrong custom object. However, with the delete action, it will direct to the page that has just been deleted! So I will look into a way to re-direct back to the page it was on. Thank you!