function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DS777DS777 

Custom Button - giving error

I am getting following error
"Unable to find form for this button" for a detail page button. Any idea what may be wrong.
werewolfwerewolf
What are the settings on the custom button?  Execute Javascript?  Run an Scontrol?  Need more detail here.
DS777DS777
// Include and initialize the AJAX toolkit library
{!REQUIRESCRIPT("/soap/ajax/12.0/connection.js")};
// Get a list of Contest Point Transaction IDs for checked valuesvar
idList = {!GETRECORDIDS($ObjectType.gii__SalesOrder__c)};
alert({!GETRECORDIDS($ObjectType.gii__SalesOrder__c)});
if (idList == null || idList.length == 0) {  
 // Nothing selected    alert('Please select one or more items.');
} else
{    // Pass list of IDs on to Class    
// result = sforce.apex.execute('MyCustomObjectClass', 'getItems', {ids : idList});
alert(" I am here");
}
 
 
following is the javascript - Execute Javascript and button at  detail
werewolfwerewolf
Well you said it was a detail page button, but you're using GETRECORDIDS.  That only works in List Buttons.
DS777DS777
realized this after posting . Now it is working.
DS777DS777
is using Web Service a better solution in above scenerio or call the class from trigger ?
Does SFDC edition (prof or enterprise) pose any problem ?
werewolfwerewolf
It depends on what you're doing.  If you're just making a single update to all the IDs then you can probably do it inline with an AJAX Toolkit call (of course, if you're doing that then you have to ask yourself if you really need to do that given the functionality in the new list views).

This button will not work in professional edition unless the PE customer has bought the API addon.