+ Start a Discussion
QuickBrownFoxQuickBrownFox 

Improvised Web to X controller

Hi Force.com,

 

First of all, thank you for being a huge help. Now I have a question.

 

I am planning to create a code that will enable me to create various types of objects using url parameters similar to that in the standard web to lead.

 

so that for a URL like this domain.force.com?o=Audits__c&Agent__c=agent&Agent_Gender__c=male

 

we have o as the object api name = Audits__c

Agent__c and Agent_Gender__c as custom fields in Audits__c

 

I wonder if it is possible to do something to the effect of

 

Audits__c a = new Audits__c();

MAP<String, String> urlp = ApexPages.CurrentPage().getParameters();

SET<String> pset = urlp.KeySet();

for(String f : pset)
            {
            a.f = urlp.get(f);
            }     

insert a;

 

I know it doesn't work like that but that explains what I'm trying to come up with.

Thank you for your help.

 

Regards,

Ceasar