+ Start a Discussion
Paul TolentinoPaul Tolentino 

How to edit an address in the Invoice created in OnClick JavaSript

How to edit an address in the Invoice created in OnClick JavaSript
AbhishekAbhishek (Salesforce Developers) 
Hi Paul,

Let's try this:
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}

try{

    var equipAssetToUpdate = new sforce.SObject("Equipment_Asset__c");

    equipAssetToUpdate.Id = "{!Equipment_Asset__c.Id}";
    equipAssetToUpdate.Ready_Date__c = new Date();
    equipAssetToUpdate.Ready_For_Sale__c = true;

    var result = sforce.connection.update([equipAssetToUpdate]);

    if(result[0].success === "true"){
        location.reload();
    }
    else{
        alert(
            "An Error has Occurred. Error: " +
            result[0].errors.message
        );
    }
}
catch(e){
    alert(
        "An unexpected Error has Occurred. Error: " + 
        e
    );
}


As of now, we don't have an exact live scenario to suggest to you but please try the above suggestion.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks.