You need to sign in to do that
Don't have an account?

Webtolead trigger
Hi,
Trigger SetRecordToFixedRecordType on Lead(before insert)
{
Id recId=recordTypeId('Lead','Lead - GOVT');
for(Lead led :Trigger.new)
{
if(led.Status__c='Submitted' && led.Web_To_Lead__c='Lead - GOVT')
{
led.RecordTypeId='012280000005fr1';
}
}
Public static Id recordTypeId(string Lead,string GOVT)
{
Id recTypeId;
if(Lead!= null && Lead - GOVT != null)
{
recTypeId= Schema.getGlobalDescribe().get(Lead).getDescribe().getRecordTypeInfosByName().get(Lead - GOVT).getRecordTypeId();
}
return recTypeId;
}
}
This is the trigger written for web to lead .when the webtolead is saved it has to to perticular record type but i am getting error.
Thanks,
swathi.
Trigger SetRecordToFixedRecordType on Lead(before insert)
{
Id recId=recordTypeId('Lead','Lead - GOVT');
for(Lead led :Trigger.new)
{
if(led.Status__c='Submitted' && led.Web_To_Lead__c='Lead - GOVT')
{
led.RecordTypeId='012280000005fr1';
}
}
Public static Id recordTypeId(string Lead,string GOVT)
{
Id recTypeId;
if(Lead!= null && Lead - GOVT != null)
{
recTypeId= Schema.getGlobalDescribe().get(Lead).getDescribe().getRecordTypeInfosByName().get(Lead - GOVT).getRecordTypeId();
}
return recTypeId;
}
}
This is the trigger written for web to lead .when the webtolead is saved it has to to perticular record type but i am getting error.
Thanks,
swathi.
Coming to your question, the following line doesn't make sense. Please fix the line to use the right attribute, maybe something like
Use following code -
You are using String value of string as variable. And might be it is giving error. Let me know in case of any query.