You need to sign in to do that
Don't have an account?
Ben4817
This will reflect my novice status, but I am just trying to build a button that will update the Serial Number on an Asset. I've tried looking for examples and can't find anything that solves my problem. The button Executes JavaScript and the Content Source is OnClick JavaScript. Following is the code that I am using, but when I click the button, I get a syntax error:
{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")}
Updating a field using S-Control
This will reflect my novice status, but I am just trying to build a button that will update the Serial Number on an Asset. I've tried looking for examples and can't find anything that solves my problem. The button Executes JavaScript and the Content Source is OnClick JavaScript. Following is the code that I am using, but when I click the button, I get a syntax error:
{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")}
function
updateSerial()
{
var
record = new sforce.SObject("Asset");
var
newRecords = [ ];
record.SerialNumber = {!Account.Product_ID__c};
newRecord.push(c);
result = sforce.connection.update(newRecord);
window.location.reload();
}
I'm sure that once I get this figured out, I'll be able to do most of the rest of what I need to do. Thanks in advance for any help!
record.SerialNumber = {!Account.Product_ID__c};
SerialNumber is a string? Then this should look like:
record.SerialNumber = "{!Account.Product_ID__c}";
It should be able to give you better error message with line number, etc.
Click on this to see the error messages.
<input class="btn" type="button" title="Update" onclick="if (window.invokeOnClickJS_00b50000000mKvC) window.invokeOnClickJS_00b50000000mKvC(this); else if (parent.window.invokeOnClickJS_00b50000000mKvC) parent.window.invokeOnClickJS_00b50000000mKvC(this); return false" name="update" value="Update"/>
I'm sure that doesn't help you too much, but I don't know what else to grab.
Really, all I'm trying to do with this is to duplicate a workflow that I have set up to run on creation of the asset. The problem is just if the Account Product ID is updated after the Asset is created and I want some way to update the field in the Asset when that happens.
Also adding alert will help.
{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")}
alert("here");
var record = new sforce.SObject("Asset");
var newRecords = [ ];
record.SerialNumber = {!Account.Product_ID__c};
newRecord.push(c);
result = sforce.connection.update(newRecord);
window.location.reload();