• Prakashb
  • NEWBIE
  • 405 Points
  • Member since 2012

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 123
    Replies
I am Creating records thru Visualforce page. Everytime I hit Save button only Id gets generated and Entered values are shown Blank.

VF
<apex:page standardController="Tandure_Domain__c" sidebar="false" extensions="attachementsample">
 <apex:form >
   <apex:pageblock >
   <apex:pageblockbuttons location="Bottom">
    <apex:commandButton value="Save" action="{!Save1}" disabled="{!save}"/>
   </apex:pageblockbuttons>
    <apex:pageblockSection title="Salesforce">  
       <apex:inputField value="{!Tandure_Domain__c.Name__c}"/>
       <apex:inputField value="{!Tandure_Domain__c.Education__c}"/>
    </apex:pageblockSection>
   </apex:pageblock>
  </apex:form>  
</apex:page>
Class
 
public class attachementsample {
public tandure_domain__c dom{get;set;}
String accid = System.currentPagereference().getParameters().get('id');

    public attachementsample(ApexPages.StandardController controller) {
    dom=new tandure_domain__c();
    }
   public void save1()
   {
     Database.upsert(dom); 
     system.debug('>>>>>'+dom); // Education and Name fields are Blank here, Only Id got generated
}
}


Thanks,
 
I cannot trace the Custom Object Called COMPLAINT in our SFDC ORG , albeit there's a tab for COMPLAINT available and working. I need to figure out the corresponding Object so that I can implement the Case management for customer complaint handling. This is very URGENT

Please help.

Thanks.

Debendra
I am having a custom button on case as related list button .
This button is on different objects like Account,opportunity,Quote and some othe custom objects.
The button works fine in out side the service cloud console , but it is nor working in console.
below code is for out side the console . I need a help how can put  this button for console.
This button also should  work in console , can any one please guide  me how to do this .

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

//Get parent ID
var x = top.window.location.pathname;
var x1 = x.substring(1,x.length);
var xpre = x1.substring(0,3);

//Parent page is Account
if (xpre == '{!$ObjectType.Account}'){
var Acc = sforce.connection.query("Select Id, Name From Account Where Id = '" + x1 + "' limit 1");
var accrecords = Acc.getArray("records"); 
if (accrecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + accrecords[0].Id + '&retURL=%2F' + x1;
}
}
//Parent page is Opportunity
else if (xpre == '{!$ObjectType.Opportunity}'){
var Opp = sforce.connection.query("Select Id, AccountId, Account.Name, Name From Opportunity Where Id = '" + x1 + "' limit 1");
var opprecords = Opp.getArray("records"); 
if (opprecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + opprecords[0].AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ opprecords[0].Id + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ opprecords[0].Name + '&retURL=%2F' + x1;
}
}
//Parent page is Quotes
else if (xpre == '{!$ObjectType.UNUM_QUOTE__c}'){
var Qte= sforce.connection.query("Select Id, Name, OPRTY_ID__r.AccountId, OPRTY_ID__r.Name, OPRTY_ID__c From UNUM_QUOTE__c Where Id = '" + x1 + "' limit 1");
var Qterecords = Qte.getArray("records"); 
if (Qterecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id='+Qterecords[0].OPRTY_ID__r.AccountId+'&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ Qterecords[0].OPRTY_ID__c+'&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ Qterecords[0].OPRTY_ID__r.Name + '&{!$Setup.OrgIDs__c.SR_Quotes__c}_lkid='+ Qterecords[0].Id+'&{!$Setup.OrgIDs__c.SR_Quotes__c}='+ Qterecords[0].Name + '&retURL=%2F' + x1;
}
}

//Parent page is Enrollment Event
else if (xpre == '{!$ObjectType.Enrol_Event__c}'){
var Enr = sforce.connection.query("SELECT Id, Name, OPRTY_ID__c, OPRTY_ID__r.Name, OPRTY_ID__r.AccountId FROM Enrol_Event__c Where Id = '" + x1 + "' limit 1");
var enrrecords = Enr.getArray("records"); 
if (enrrecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + enrrecords[0].OPRTY_ID__r.AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ enrrecords[0].OPRTY_ID__c + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ enrrecords[0].OPRTY_ID__r.Name + '&{!$Setup.OrgIDs__c.SR_ENROL_EVENT_ID__c}_lkid=' + enrrecords[0].Id + '&{!$Setup.OrgIDs__c.SR_ENROL_EVENT_ID__c}=' + enrrecords[0].Name + '&retURL=%2F' + x1;
}
}
//Suresh Added 
//Parent page is Rating Product 
else if (xpre == '{!$ObjectType.UW_Rating_Products__c}'){ 

var Enr = sforce.connection.query("SELECT Id ,Name,OPPTY_ID__c,    OPPTY_ID__r.Name, OPPTY_ID__r.AccountId, UNUM_QUOTE_ID__c, UNUM_QUOTE_ID__r.Name, PRODT_ID__r.Name, PRODT_ID__c FROM UW_Rating_Products__c Where Id = '" + x1 + "' limit 1"); 

var enrrecords = Enr.getArray("records"); 

if (enrrecords.length > 0){ 

top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + enrrecords[0].OPPTY_ID__r.AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ enrrecords[0].OPPTY_ID__c + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ enrrecords[0].OPPTY_ID__r.Name +'&{!$Setup.OrgIDs__c.SR_Quotes__c}_lkid='+ enrrecords[0].UNUM_QUOTE_ID__c + '&{!$Setup.OrgIDs__c.SR_Quotes__c}='+ enrrecords[0].UNUM_QUOTE_ID__r.Name +'&{!$Setup.OrgIDs__c.SR_Rating_Product_ID__c}_lkid='+ enrrecords[0].Id + '&{!$Setup.OrgIDs__c.SR_Rating_Product_ID__c}='+ enrrecords[0].Name + '&{!$Setup.OrgIDs__c.SR_Rating_Product_Name__c}='+enrrecords[0].PRODT_ID__r.Name+'&retURL=%2F' + x1; 
Hi Guys,
Can you please help me out with the formula field it is very urgent. I have this formula field below and I need to update this field to get calculated date based on business days. Suppose if Record CreatedDate is on Friday then Estimated Completion Date + 2 Shouldn't be Date of Sunday it should be the Date whichever will be on Tuesday. 

Formula Field Name: Estimated_Completion_Date__c 
Field Type:  Date 
CASE(RecordType.Name, "Credit Request", CreatedDate + 2, "Cancellation", CreatedDate + 2, "Invoice/Usage Report", CreatedDate + 2, "New Order Assistance/Special Terms", CreatedDate + 1, "Technical Issue", CreatedDate + 2, "Vendor Information", CreatedDate + 2, "Purchase Order Submission", CreatedDate + 2, "Change of Address/Invoice Recipient Request", CreatedDate + 2, "Organic Growth", CreatedDate + 2, "Account Number Issue", CreatedDate + 5, Null)

Thanks Guys 
Hi folks,

Could you plz tell me how to add custom vf page as a related list in standard object?
I need to geenrate a report with Count /List of opportunities where Opportunity team member is not added. How can i do this without customization?

I am able to generate opportunitieis with team members and thier count.
 public pagereference submit()
    {
       integer count = [select count() FROM Sworn_Undertaking__c WHERE id =:swornUT.id];
        if (count>0)  // Error at this Line
        {
        if(SUT.submit_done__C == false)
        {
            sakid = 'Y';
            system.debug('***sakid'+sakid);
            SUT.City_of__c = swornUT.City_of__c;
            SUT.Address__c = swornUT.Address__c;
             upsert SUT;    
                
        }
        else
        {
             sakid = 'N';
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));   
        }
        return null;
        else
        {
             sakid = 'N';
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));   
        }
        
        
         pagereference pdf = page.pdfSwornUndertaking;
         pdf.getParameters().put('id',SUT.New_applicant_Name__c);
         Attachment attach = new Attachment();
         Blob body;
         try
         {
             body=pdf.getcontent();
         }
         catch(visualforceException e)
         {
             body=Blob.valueOf('Some Text');
         }
         return null;
        
}}

I have given return null but its still shows the same.. Am i wrong Anywhere?
Hi,

I have the below trigger that makes an @future call to an apex class.
This line  UpliftmentRequestFutureWebService.sendvehiclerequest makes the call.

I have tried various things in my test class such as test.startTest() and test.stopTest() and still fails with a "Methods defined as TestMethod do not support Web service callouts, test skipped".

Any guidance is very welcome on this!


trigger UpliftmentRequestCreate on Vehicle__c (after insert) {
    
    DateTime createdate = system.now();
    String dateofrequest;
    Integer insurer;
    String claimno;
    DateTime dateoflossconvert;
    String dateofloss;
    Integer vehiclecondition;
    String customerfirstname;
    String customerlastname;
    String vehiclemake;
    String vehiclemodel;
    String vehiclemmcode;
    String vehicleyear;
    String vehicleregistrationno;
    String vehiclecommercialpassenger;
    String locationname;
    String locationcontactperson;
    String locationcontactno;
    String locationemailaddress;
    String locationstreetaddress;
    String locationsuburb;
    String locationpostalcode;
    String locationcity;
    String locationprovince;
    String createuserfirstname;
    String createuserlastname;
    String salesforcecapturer;
    String salesforcerefno;
    String refno;
    id customer;
    id vehicleid;
        
    User currentuser=[Select FirstName, LastName from User Where Id =: UserInfo.getUserId() LIMIT 1];
    createuserfirstname = currentuser.FirstName;
    createuserlastname = currentuser.LastName;
    salesforcecapturer = createuserfirstname+' '+createuserlastname;
    system.debug ('Current User : ' + createuserfirstname +' '+createuserlastname);

    for (Vehicle__c v : Trigger.new) {
        vehicleid = v.id;
        customer = v.Customer__c;
        //
        //DateOfRequest    
        if (v.Insurance_Group__c == 'AFI' || v.Insurance_Group__c == 'Zurich'){
            
        dateofrequest = createdate.format('yyyy/MM/dd HH:mm:ss');
        system.debug ('Date of Request New : ' + dateofrequest);                               
        //
        //Insurer
        if (v.Insurance_Group__c != null){
                if (v.Insurance_Group__c == 'AFI'){
                    insurer = 26;
                }
                
                else if (v.Insurance_Group__c == 'Zurich'){
                    insurer = 347;
                }
                else{
                    insurer = 1;
                }
        }
        else{
                insurer = 0;
        }
        system.debug('Insurer : ' + insurer);
        //
        //ClaimNumber                
        if (v.PolicyNo__c != null){
                claimno = v.PolicyNo__c;
        }
        else{
                claimno = 'Not Specified';
        }
        system.debug('Claim No : ' + claimno);
        //
        //DateOfLoss    
        if (v.Date_Of_Loss__c != null){
                
                dateoflossconvert = DateTime.newInstance(v.Date_Of_Loss__c.year(), v.Date_Of_Loss__c.month(), v.Date_Of_Loss__c.day());
                dateofloss = dateoflossconvert.format('yyyy/MM/dd HH:mm:ss');
        }
        else{
                dateofloss = null;
        }        
        system.debug('Date of Loss : ' + dateofloss);
        //
        //VehicleCondition        
        if(v.Vehicle_Condition__c != null){
                if (v.Vehicle_Condition__c == 'Repairable'){
                    vehiclecondition = 1;
                }
                else if (v.Vehicle_Condition__c == 'WriteOff'){
                    vehiclecondition = 2;
                }
                else{
                    vehiclecondition = 0;
                }
        }
        else{
                vehiclecondition = 0;
        }
        system.debug('Vehicle Condition : ' + vehiclecondition);
        //
        //VehicleCommercialPassenger
        if(v.Vehicle_Commercial_Passenger__c != null){
                vehiclecommercialpassenger = v.Vehicle_Commercial_Passenger__c;
        }
        else{
                vehiclecommercialpassenger = 'Not Specified';
        }
        system.debug ('Vehicle Commercial Passenger : ' + vehiclecommercialpassenger);
        //
        //VehicleMake
        if(v.Make__c != null){
            vehiclemake = v.Make__c;
        }    
        else{
            vehiclemake = 'Not Specified';
        }
        system.debug ('Vehicle Make : ' + vehiclemake);
        //
        //VehicleModel
        if (v.Model__c != null){
                vehiclemodel = v.Model__c;
        }        
        else{
                vehiclemodel = 'Not Specified';
        }
        system.debug('Vehicle Model : ' + vehiclemodel);
        //
        //VehicleMMCode
        if (v.MMCode__c != null){
            vehiclemmcode = v.MMCode__c;
        }
        else{
            vehiclemmcode = 'Not Specified';
        }
        system.debug ('Vehicle MMCode : ' + vehiclemmcode);
        //
        //VehicleYear
        if (v.Reg_Year__c != null){
                vehicleyear = v.Reg_Year__c;    
        }
        else{
                vehicleyear = 'Not Specified';
        }
        system.debug('Vehicle Year : ' + vehicleyear);
        //
        //VehicleRegistrationNumber
        if(v.RegNo__c != null){
                vehicleregistrationno = v.RegNo__c;    
        }
        else{
                vehicleregistrationno = 'Not Specified';
        }
        system.debug('Vehicle Registration No : ' + vehicleregistrationno);
        //
        //LocationName
        if (v.MBR_Name__c != null){
                locationname = v.MBR_Name__c;    
        }
        else {
                locationname = 'Not Specified';
        }
        system.debug('Location Name : ' + locationname);
        //
        //LocationContactPerson    
        if (v.MBR_Contact_Person__c != null){
                locationcontactperson = v.MBR_Contact_Person__c;    
        }
        else{
                locationcontactperson = 'Not Specified';
        }
        system.debug('Location Contact Person : ' + locationcontactperson);
        //
        //LocationEmailAddress    
        if (v.MBR_Email__c != null) {
                locationemailaddress = v.MBR_Email__c;    
        }
        else {
                locationemailaddress = 'Not Specified';
        }
        system.debug('Location Email Address : ' + locationemailaddress);
        //
        //LocationStreetAddress    
        if (v.MBR_Address__c != null){
                locationstreetaddress = v.MBR_Address__c;    
        }
        else {
                locationstreetaddress = 'Not Specified';
        }
        system.debug('Location Address : ' + locationstreetaddress);
        //
        //LocationSuburb    
        if (v.MBR_Suburb__c != null){
                locationsuburb = v.MBR_Suburb__c;    
        }
        else{
                locationsuburb = 'Not Specified';
        }
        system.debug('Location Suburb : ' + locationsuburb);
        //
        //LocationPostalCode
        if (v.MBR_Postal_Code__c != null){
            locationpostalcode = v.MBR_Postal_Code__c;
        }
        else{
            locationpostalcode = '';
        }
        //
        //LocationCity
        if (v.MBR_City__c != null){
            locationcity = v.MBR_City__c;
        }
        else{
            locationcity = '';
        }
        //
        //LocationProvince    
        if (v.MBR_Province__c != null){
                locationprovince = v.MBR_Province__c;    
        }
        else {
                locationprovince = 'Not Specified';
        }        
        system.debug('Location Province : ' + locationprovince);    
        //
        //LocationContactNumber    
        if (v.MBR_Contact_No__c != null){
                locationcontactno = v.MBR_Contact_No__c;
        }
        else{
                locationcontactno = 'Not Specified';
        }
        system.debug('Location Province : ' + locationcontactno);
        //
        //SalesforceReferenceNumber    
        if (v.StockNo__c != null){
                salesforcerefno = v.StockNo__c;    
        }
        else{
                salesforcerefno = 'Not Specified';
        }
        //
        }    
    }
    
    for (Account a : [Select Id, FirstName, LastName from Account where Id =: customer LIMIT 1]) {
        
        if (a.FirstName != null){
            customerfirstname = a.FirstName;    
        }
        else {
            customerfirstname = 'Not Specified';
        }
        
        if (a.LastName != null){
            customerlastname = a.LastName;    
        }
        else{
            customerlastname = 'Not Specified';
        }
        system.debug('Customer Name : ' + customerfirstname +' '+ customerlastname);
    }
    
        
    for (Vehicle__c v : Trigger.new) {
        
        if (v.Insurance_Group__c == 'AFI' || v.Insurance_Group__c == 'Zurich'){ 
    
                try {
                
                system.debug ('About to call the web service class');
                UpliftmentRequestFutureWebService.sendvehiclerequest(dateofrequest, insurer, claimno, dateofloss, vehiclecondition, customerlastname, customerfirstname, vehiclecommercialpassenger, vehiclemake, vehiclemodel, 
                                                                     vehicleMMCode, vehicleyear, vehicleregistrationno, locationname, locationcontactperson, locationcontactno, locationemailaddress, locationstreetaddress, 
                                                                     locationsuburb, locationpostalcode, locationcity, locationprovince, salesforcecapturer, salesforcerefno);        
                }
                    catch(DmlException e){
                    system.debug('The following exception has occured: ' + e.getMessage());
                }
        }
    }            
}
Hello, 

I have a Master - Detail Relationship between two objects, say, Tasks__c and Projects__c. Each Project is supposed bto have a few tasks. So when I display the instances of the tasks in the Tasks tab, I also want to display the details of the project it is related to. Right now, I am able to display the Project__c id, i.e., the index field, but not the name of the project or any other detail. A screenshot of the current Tab is attached below. Please help!!

PS: This is a very basic thing which I can easily do in a custom visualforce page. Calling this feild name  : Project__r.Project_Name__c.
But, how do I display this field in Salesforce defined detailed page. 
User-added image

I want to show the Project Name here as well.
Can any one help me out on this?how to write a Test class for the trigger.Any help is very much appreciated.

Trigger:
 
trigger ReparentComment on CaseComment (before insert) {
    Map<String, Case> newCaseMap = new Map<String, Case>();
    Set<Id> caseIds = new Set<Id>();
    Map<Id, List<CaseComment>> ccMap = new Map<Id, List<CaseComment>>();
    List<CaseComment> newCCList = new List<CaseComment>();
    for(CaseComment cc : trigger.new)
    {
        caseIds.add(cc.ParentId);
        List<CaseComment> ccList = ccMap.get(cc.ParentId);
        if(ccList == null)
            ccList = new List<CaseComment>();
        ccList.add(cc);
        ccMap.put(cc.ParentId, ccList);
    }
    for(Case c : [Select Id, Subject From Case Where Id in :caseIds Order by CreatedDate])
        if(newCaseMap.containsKey(c.Subject))
            for(CaseComment cc : ccMap.get(c.Id))
            {
                CaseComment newCC = cc.clone();
                newCCList.add(newCC);
                newCC.ParentId = newCaseMap.get(c.Subject).Id;
            }
        else
            newCaseMap.put(c.Subject, c);

    for(Case c : [Select Id, Subject From Case Where Subject in :newCaseMap.keySet() And Id not in :caseIds And Status != 'Closed'])
        for(CaseComment cc : ccMap.get(newCaseMap.get(c.Subject).Id))
        {
            CaseComment newCC = cc.clone();
            newCCList.add(newCC);
            newCC.ParentId = c.Id;
        }
    insert newCCList;
}

Test Class :
 
@istest
public class TestReparentComment{
static TestMethod void testcomment(){
list<casecomment> ccomment = new list<casecomment>();
for(integer i=0;i<200;i++){
case c= new case(subject='RE:');
insert c
casecomment cc = new casecomment(cc.commentBody = c.Description)
Parentid=c.id;
insert cc;
List<case> insertedcases =[Select Name ,Subject,status from case Where Id in :c.Id Order by CreatedDate];
for(case c :insertedcases){
system.assertEquals(
'NotClosed',c.status);
}
}
}

 
I am attempting to schedule and email a report, and the user I want to email it to is not coming up in the "Select From" list in order for me to add them. How do I fix this in this persons profile so when I select "users" the name I want pops up. Attached is a screen shot of the directions. 

User-added image
User-added image
Hi All,
I need to pull one single report, Its like combining of two reports.. Contacts with sponsership details also contacts with affiliation details.
Sponsership has lookup field to contact and Affiliation too.. How can i cobine all these data in single report ??

Thanks.
Hello,
Below are my Visual force and controller code. I would like display Account name as read only field from the list of items. 
Unfortunately I am getting error as Error: Unknown property 'VisualforceArrayList.name'

visualforce page:

<apex:page controller="AccountInformation">
<apex:form>
<apex:sectionHeader title="ACCOUNT DETAILS"/>
<apex:pageBlock title="Detailed Information">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save"/>
<apex:commandButton value="Cancel"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Account Information">
<apex:pageBlockSectionItem>
Account Name <apex:outputText value="{!accountlist.name}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection title="Billing Information">
<apex:pageBlockSectionItem>
Billing Street <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing City <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing State <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing Country <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing PostalCode <apex:outputText />
</apex:pageBlockSectionItem>

</apex:pageBlockSection>



<apex:pageBlockSection title="Shipping Information">
<apex:pageBlockSectionItem>
Shipping Street <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping City <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping State <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping Country <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping Zipcode <apex:outputText />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:selectList>
</apex:pageBlock>
</apex:form>
</apex:page>



controller code:

public class AccountInformation
{

    public PageReference edit() {
    
    string str = apexpages.currentpage().getparameters().get('Accountid');
    System.debug('str+-------'+str);
    pagereference pg = new pagereference('/'+str+'/e');
        return pg;
    }







public list<Account> accountlist{get;set;}
public AccountInformation()
{
accountlist = new list<Account>();
accountlist = [SELECT Name,BillingStreet,BillingCity,BillingCountry,BillingPostalCode,BillingState,ShippingStreet,ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState FROM Account order by Name asc
];

}








}
Hi everyone,
I'm trying to learn on the fly here, my knowledge is more around triggers.

I'm trying to create a List button to automatically create three records, basically I'm trying to create my own grocery list and just automate a few items.

Class and Method:
Global class addGroceries {
    WebService static void addSomeGroceries(){
        List<Groceries__c> groc = new List<Groceries__c>();
        Groceries__c g1 = new Groceries__c(Name='Garlic', Category__c='1 - Fruit and Vegetables');
        groc.add(g1);
        
        Groceries__c g2 = new Groceries__c(Name='Onions', Category__c='1 - Fruit and Vegetables');
        groc.add(g2);
        
        Groceries__c g3 = new Groceries__c(Name='Pears', Category__c='1 - Fruit and Vegetables');
        groc.add(g3);
        insert groc;            
    }
}

Onclick Javascript button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
sforce.apex.execute("addGroceries","addSomeGroceries",{});
window.location.reload();

Error message
A problem with the OnClick JavaScript for this button or link was encountered:

args not specified

Everything I look up seems to reference passing parameters as part of the button, but I don't have anything to pass here.  
I'm assuming that it's something obvious

Thanks very much



 
I have one custom field on user object like "Notify me of releases" which data type is checkbox . When user select "Notify me of releases" checkbox checked  user will get notification for every update of  article whose type is alert. 
Note:- I have created one article type alert.