<h1>Generate Salesforce Record Baseline Script</h1>Object Type: <dlog:TextBox id="ObjectType" /> RecordId: <dlog:TextBox id="RecordID" /> <dlog:Button id="SubmitButton" Text="Generate Baseline Script" /><br/><dlog:Label id="Output" /><%from CubicCompass.Portal.Webparts.Salesforce.sForce import *def CodeGen(): objectDescription = SalesforceSettings.Instance.SForceService.describeSObject(ObjectType.Text) query = "select " for field in objectDescription.fields: query += field.name + ", " query = query.TrimEnd(", ".ToCharArray()) query += " from " + ObjectType.Text if RecordID.Text.Length > 0: query += " where Id='" + RecordID.Text + "'" result = SalesforceSettings.Instance.SForceService.query(query) if result.size == 0: Output.Text = "record not found" return sObject = SalesforceObject(result.records[0]) indent = " " code = "def Reset" + ObjectType.Text + "Defaults():<br/>" code += indent + "sforce = SalesforceWebService()<br/>" code += indent + "sforce.SalesforceRecordID = \"" + RecordID.Text + "\"<br/>" for field in objectDescription.fields: if field.updateable == False: continue code += indent + "sforce.AddField(\"" + field.name + "\", \"" + sObject.GetProperty(field.name) + "\")<br/>" code += indent + "sforce.UpdateObject(\"" + ObjectType.Text + "\")<br/>" Output.Text = code if Page.IsPostBack: if ObjectType.Text.Length == 0 or RecordID.Text.Length == 0: Output.Text = "missing values" else: CodeGen()else: ObjectType.Text = "Account" RecordID.Text = "testRecordId"%>