You need to sign in to do that
Don't have an account?
SFDC coder
how to pass parameters using URLFOR()
How to pass parakmeters using URLFOR()hi all,
i have a scenario where in i need to prepopulate a field eventId of type text with event object's id passed using URLFOR().
However i get an error saying
Syntax error. Found '['
below is my code1 new_url = "{!URLFOR( $Action.Order__c.New, null, [00N11000000srcf=Event.Id])}";
2 window.location.replace(new_url);where 00N11000000srcf is fetched after i right click on text field-->inspect element and copy the id of the field to be prepopulated
any help is appreciated
i have a scenario where in i need to prepopulate a field eventId of type text with event object's id passed using URLFOR().
However i get an error saying
Syntax error. Found '['
below is my code1 new_url = "{!URLFOR( $Action.Order__c.New, null, [00N11000000srcf=Event.Id])}";
2 window.location.replace(new_url);where 00N11000000srcf is fetched after i right click on text field-->inspect element and copy the id of the field to be prepopulated
any help is appreciated
i have solved this using,single quotes around the id(last field ' 00N11000000srcf ')
new_url = "{!URLFOR( $Action.Order__c.New, null, [CF00N20000009GubC=Event.What,CF00N20000009GubC_lkid=Event.What.Id,'00N11000000srcf'=Event.Id])}";
window.location.replace(new_url);
All Answers
Your syntax is correct, but, do you try to use URLFOR in the controller ?
This method is a Visualforce function, so you can only use it in the VF page.
Hope this helps
Gil
Question Solved ? Please mark as the best answer to help other users !
now i am getting an error as Error: Syntax error. Missing field name
below is my code
where CF00N20000009GubC is the HTML id of a lookup field.I am trying to populate it with the event objects RelatedTo(What) field
i have solved this using,single quotes around the id(last field ' 00N11000000srcf ')
new_url = "{!URLFOR( $Action.Order__c.New, null, [CF00N20000009GubC=Event.What,CF00N20000009GubC_lkid=Event.What.Id,'00N11000000srcf'=Event.Id])}";
window.location.replace(new_url);