<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ladysign Dev Blog &#187; s-controls</title>
	<atom:link href="http://www.ladysign-apps.com/blog/tag/s-controls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ladysign-apps.com/blog</link>
	<description>Girls can code.</description>
	<lastBuildDate>Mon, 12 Dec 2011 16:58:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Salesforce Query Functions</title>
		<link>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-query-functions/</link>
		<comments>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-query-functions/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 21:25:23 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[salesforce]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[queries]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[s-controls]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=60</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>These handy Salesforce functions I used a lot, for doing Salesforce database queries.<br />
You can use these functions in your[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/salesforce/salesforce-query-functions/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>These handy Salesforce functions I used a lot, for doing Salesforce database queries.<br />
You can use these functions in your S-Controls:</p>
<pre class="brush: jscript; title: ;">
/**
 * Get an array with all the possible fields names from a object
 * @param objectType object to get the fields from.
 * @return array with all the fieldnames of the given object
 */
function getFields(objectType) {
	var describeSObjectResult, fields, i;

	describeSObjectResult = sforce.connection.describeSObject(objectType);
	fields = [];
	var length = describeSObjectResult.fields.length;
	for (i = 0; i &lt; length; i++)
	fields[i] = describeSObjectResult.fields[i].name;

	return fields;
}

/**
* Result handler, forwards you to the detail page,
* if there is an error give alert message.
* @param result - can be a (sf query) object, or a textmessage string.
* @param idVal - the id of the detailpage to forward to.
*/
function resultHandler(result, idVal){
	var msg = &quot;&quot;;

	if (typeof(result) == &quot;object&quot;) {
		if (result[0].getBoolean(&quot;success&quot;)) {
			msg = &quot;&quot;;
		} else {
			msg = &quot;Error: &quot; + result[0];
		}
	} else {
		msg = result;
	}
	if (msg != &quot;&quot;){
		alert(msg);
	}
	self.location.href = &quot;/&quot; + idVal;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-query-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salesforce date/time functions</title>
		<link>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/</link>
		<comments>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 21:15:39 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[salesforce]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[s-controls]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=57</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Oh I loved my previous project, where I had to work with the CRM: Salesforce.<br />
Salesforce coding was fun: S-Controls (ifra[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Oh I loved my previous project, where I had to work with the CRM: Salesforce.<br />
Salesforce coding was fun: S-Controls (iframes), Salesforce Ajax (Javascript with Salesforce Query Language) and Apex (Java like Salesforce serverside coding).</p>
<p>These are handy Salesforce date/time functions which you can use in your S-Controls:</p>
<pre class="brush: jscript; title: ;">
/**
* Return the current time
* @return javascript date time object
*/
function getCurrentSalesForceTime(){
	var currentDateTime = sforce.connection.getServerTimestamp();
	currentDateTime = setStringToDateTime(currentDateTime.timestamp);

	return currentDateTime;
}

/**
* Set Javascript Date Time to Salesforce Date Time;
* @param dateTimeObj - date time string
* @return salesforce date time object
**/
function setStringToDateTime(dateTimeObj){
	var dateTimeObj;

	if (dateTimeObj != null) {
		dateTimeObj = sforce.internal.stringToDateTime(dateTimeObj);
	}

	return dateTimeObj;
}

/**
* Set Salesforce Date Time Object to Javascript Date Time
* @param dateTimeObj - Salesforce date time object
* @return string date time
**/
function setDateTimeToString(dateTimeObj){
	var dateTimeObj;

	if (dateTimeObj != null) {
		dateTimeObj = sforce.internal.dateTimeToString(dateTimeObj);
	}

	return dateTimeObj;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

