You need to sign in to do that
Don't have an account?
updating field in javascript
Hi All,
My requirement is:
In a search(search means :click on any object---->click on go---> here we are selecting multiple checkboxes),added one button(Update). On click of button implemented java script code as a
-------------------------------------------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")};
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.WLM_Work_Request__c)};
var updateRecords = [];
if (records[0] == null) {
alert('Please select at least one record to take ownership');
}
else {
for (var a=0; a<records.length; a++ )
{
var update_Engineer = new sforce.SObject("WLM_Work_Request__c");
update_Engineer.Id = records[a];
update_Engineer.Assigned_EngineerId__c= '{!User.Id}';
update_Engineer.OwnerId = '{!User.Id}';
updateRecords.push(update_Engineer);
}
result = sforce.connection.update([updateRecords]);
alert('Processing6666666666......');
parent.location.href = url;
}
--------------------------------------------------------------------------------------------------
problem is: field is not updating but I am getting processing6666666666 alert.
Hi,
Try the below code:
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")};
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.WLM_Work_Request__c)};
var updateRecords = [];
if (records[0] == null) {
alert('Please select at least one record to take ownership');
}
else {
for (var a=0; a<records.length; a++ )
{
var update_Engineer = new sforce.SObject("WLM_Work_Request__c");
update_Engineer.Id = records[a];
update_Engineer.Assigned_EngineerId__c= '{!User.Id}';
update_Engineer.OwnerId = '{!User.Id}';
updateRecords.push(update_Engineer);
}
result = sforce.connection.update(updateRecords);
alert('Processing6666666666......');
window.location.reload();
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.