12/18/2015 - 1:35 PM


function newCredentialForm(){
	var tableName = g_form.getTableName();
	var sysID = g_form.getUniqueValue();
	//Get the values from the Incident Table so we can write-back to it
	var comments = g_form.getValue('comments');
	var short_description = g_form.getValue('short_description');
	var work_notes = g_form.getValue('work_notes');
	var number = g_form.getValue('number');
	var userID = g_form.getValue('caller_id');
	//Create and open the dialog form
	var dialog = new GlideDialogForm('Create Temporary Credential', 'u_temp_credential',callbackFunct);
	dialog.setSysID(-1); //Pass in sys_id to edit existing record, -1 to create new record
	dialog.addParm('sysparm_view', 'credential_view'); //Use the Credential view of the form
	dialog.addParm('sysparm_form_only', 'true'); //Remove related lists	
	//Callback inserts values into the Computer record after data are returned from the server  
	dialog.setLoadCallback(function(iframeDoc) {
		// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
		var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
		//Hide the "Created from (u_parent) and For User (u_for_user) fields
		dialogFrame.g_form.setDisplay('u_parent', false);
		dialogFrame.g_form.setDisplay('u_for_user', false);
		dialogFrame = null;
	dialog.render(); //Open the dialog

//this is my callback function.  All I am doing is taking the username and using the setValue to place it in the additional comments field.
function callbackFunct(action, sys_id, table, displayValue) {
	var credURL = 'View your temporary password at the following URL:\n https://wesco.service-now.com/u_temp_credential_list.do';