+ Start a Discussion
Daniel AlanizDaniel Alaniz 

Custom Button to update a checkbox

Need a litte guidence as i am HUGE novice , I am trying to create a Button on a custom object that will update a custom Checkbox I know it would be simple to just manually check the box but FOR SOM REASON the sales reps can not remember to do this so i think a button would be better for them.
This is what i have so far
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Inventory_Transfer_c");
c.id ="{!Inventory_Transfer__c.Id}";
c.Ready_to_process__c = true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();

I am receving the following error
{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'Inventory_Transfer_c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'Inventory_Transfer_c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', row:'-1', column:'-1', }, }, }

Many Thanks
Best Answer chosen by Daniel Alaniz
KaranrajKaranraj
Make sure that you have entered correct API name of the object.
If you have namespace in your org then you have to append before the objectname with double underscore like namespace__Objectname__c

All Answers

KaranrajKaranraj
Make sure that you have entered correct API name of the object.
If you have namespace in your org then you have to append before the objectname with double underscore like namespace__Objectname__c
This was selected as the best answer
Daniel AlanizDaniel Alaniz
Thank you that was the issue! One other question is the a way to also have the page close when the button is pressed in addtion to updating the check box?
KaranrajKaranraj
Use window.close(); or redirect the user to the home page 
window.location.href = '​/home/home.jsp'