Determine if record is saved

Sometimes we need to determine in JavaScript if record is already saved or not. You can use this function for this:

/**
 * Check if we are creating a new record,
 */
function areCreatingNewRecord(){
  var record_id = document.getElementById("hdRecordID").value;
  if (record_id == '00000000-0000-0000-0000-000000000000'){
    return true;
  }else{
    return false;
  }
}
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

4 Responses to Determine if record is saved

  1. Dan Hutson says:

    Is there anything similar to test if a workflow has not been submitted, has been saved as draft or has been submitted?

    Thanks

    Dan

  2. Dan Hutson says:

    function areCreatingNewWorkflow(){

    var instance_id = document.getElementById("instanceID").value;
    if (!!instance_id){
    return true; //workflow has been submitted
    } else {
    return false; //workflow is new or in draft
    }
    }

  3. Dan Hutson says:

    Apologies, the ‘return true;’ should be in the else section as you’re testing if it’s a new workflow

Leave a Reply

Your email address will not be published. Required fields are marked *