+ Start a Discussion
sathya82sathya82 

Compile Error: line 6:5 no viable alternative at character '' at line 6 column 5

trigger insertMember2 on Account (after insert) {
 Set<Id> Ids= new Set<Id>();
    for (Account member : Trigger.new)
    {
        Ids.add(member.Id);        
    }
 List<Account> memberList = new List<Account>([Select Id,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry From Account e where Id in :Ids]);

    for(Account temp : memberList )
    {
        Quote member2 = new Quote();
        member2.ShippingStreet = temp.BillingStreet;
        member2.ShippingCity = temp.BillingCity;
        member2.ShippingState = temp.BillingState;
        member2.ShippingPostalCode = temp.BillingPostalCode;
        member2.ShippingCountry = temp.BillingCountry;
        insert member2;

    }


 }

 How can i solve this error..??

Subhash GarhwalSubhash Garhwal

Hi sathya,

 

Firstly you need enable Quotes for your org.

 

for this go to 

 

Setup -> Customize -> Quotes -> Settings -> than click on " Enable Quotes" check box and save

 

than try this one

 

trigger insertMember2 on Account (after insert) {

List<Quote> QuoteList = new List<Quote>();

 

//Check for the request type
if(Trigger.isAfter) {

//Check for trigger event
if(Trigger.isInsert) {

for(Account temp : Trigger.new) {

Quote member2 = new Quote();
member2.ShippingStreet = temp.BillingStreet;
member2.ShippingCity = temp.BillingCity;
member2.ShippingState = temp.BillingState;
member2.ShippingPostalCode = temp.BillingPostalCode;
member2.ShippingCountry = temp.BillingCountry;

//Add in list
QuoteList.add(member2);

}
}
}

//Check for List size
if(QuoteList.size() > 0)
    insert QuoteList;
}

 

for trigger you can go through this post

http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%E2%80%93-creating-trigger-and-test-cases-%E2%80%93-6-of-6/

 

Thanks

 

Hit the Kudos button (star)  and Mark as solution if it post helps you

RockzzRockzz

Hi,

I am trying save ur trigger in DE edition I am getting error:Error: Compile Error: Entity is not org-accessible at line 1 column 1 ..please check below code ..i haev added red font for that..

trigger insertMember2 on Account (after insert) {
 Set<Id> Ids= new Set<Id>();
    for (Account member : Trigger.new)
    {
        Ids.add(member.Id);        
    }
 List<Account> memberList = new List<Account>([Select Id,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry From Account e where Id in :Ids]);

    for(Account temp : memberList )
    {
        Quote member2 = new Quote();
        member2.ShippingStreet = temp.BillingStreet;
        member2.ShippingCity = temp.BillingCity;
        member2.ShippingState = temp.BillingState;
        member2.ShippingPostalCode = temp.BillingPostalCode;
        member2.ShippingCountry = temp.BillingCountry;
        insert member2;

    }


 }

 

Thanks,

Cool Sfdc

sathya82sathya82

@SUBHASH

 

 

      WHEN I USE your trigger, i am getting an error whiel converting lead to account.quotename,opportunity name is not created.

 for this may i know what i have to do.