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; } }
Is there anything similar to test if a workflow has not been submitted, has been saved as draft or has been submitted?
Thanks
Dan
Dan, I never had a need for that. But your code snippet looks like spot-on.
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
}
}
Apologies, the ‘return true;’ should be in the else section as you’re testing if it’s a new workflow