Username: Password:

Direct Connect API


Blend library, Version 1.0
Platform abstractions for sforce, connect, quickbase, azure, amazon, and desktop
Copyright 2009 DreamFactory Software, Inc.

User Login -> interactive interface for login using user credentials
username is a string typically email address of user
password is platform-acceptable password string for the username
promptuser is a boolean where true prompts the user to pick a workspace from a list,
false means no workspace or the workspace is provided in the extras param
extras is a xml formatted string with platform-specific attributes (see platform for details)

blend_user_login("johnsmith@work.com", "password123", false, "Sales")
returns "OK", platform-specific login failure error, or DFAC Error for invalid platform
requires global master_platform to be set prior to calling this method.

code blend_user_login(username, password, promptuser, extras)
	global master_platform, master_flavor, master_application
	local results, sandbox, metadata
	
	switch master_platform
	case "sforce"
		extras could have sandbox and metadate bool fields
		extras = "truetrue"
		sandbox = false
		metadata = false
		if extras != 0 and extras != empty
			if coercetoboolean(extras.sandbox)
				sandbox = true
			endif
			if coercetoboolean(extras.metadata) and sforce_metadata_supported()
				metadata = true
			endif
		endif
			
		if sandbox
			results = sforce_login_sandbox(username, password)
			if not sforce_error(results)
				if metadata
					results = metadata_login_sandbox(username, password)
				endif
			endif
		else
			results = sforce_login(username, password)
			if not sforce_error(results)
				if metadata
					results = metadata_login(username, password)
				endif
			endif
		endif
		return results
	case "connect"
		return connect_user_login(username, password, promptuser, extras)
	case "amazon"
		return amazon_user_login(username, password, promptuser, extras)
	case "quickbase"
		return quickbase_user_login(username, password, promptuser, extras)
	case "azure"
		return azure_user_login(username, password, promptuser, extras)
	case "desktop"
		return desktop_login(username, password)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Valid Platform -> validate currently supported platforms
platform is a internal simple string name of platform to validate

blend_valid_platform("sforce")
returns true for supported platforms, false otherwise

code blend_valid_platform(platform)
	
	switch platform
	case "sforce", "connect", "amazon", "quickbase", "azure", "desktop"
		return true
	endswitch
	return false
endcode

Valid Creds -> validate user login credentials, typically used when username is known,
password is requested from user before performing functions like sending active links
username is a string typically email address of user
password is a platform-acceptable password string for the username
extras is a xml formatted string with platform-specific attributes (see platform for details)

blend_valid_creds("johnsmith@work.com", "password123", "Sales")
returns "OK", platform-specific login failure error, or DFAC Error for invalid platform
requires global master_platform to be set prior to calling this method.

code blend_valid_creds(username, password, extras)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_valid_creds(username, password, extras)
	case "connect"
		return connect_valid_creds(username, password, extras)
	case "amazon"
		return amazon_valid_creds(username, password, extras)
	case "quickbase"
		return quickbase_valid_creds(username, password, extras)
	case "azure"
		return azure_valid_creds(username, password, extras)
	case "desktop"
		return desktop_valid_creds(username, password, extras)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Error -> checks for errors in response from other blend calls
results is a platform-dependent response from other calls

blend_error("Sales")
returns true if the results contain a platform-specific error, or for invalid platform, false otherwise
requires global master_platform to be set prior to calling this method.

code blend_error(results)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_error(results)
	case "connect"
		return connect_error(results)
	case "amazon"
		return amazon_error(results)
	case "quickbase"
		return quickbase_error(results)
	case "azure"
		return azure_error(results)
	case "desktop"
		return desktop_error(results)
	endswitch
	return true
endcode

Get Global Param -> retrieve global parameter values from the platform
thename is a generic or platform-dependent parameter

blend_global_param("user_id")
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_global_param(thename)
	global master_platform, master_flavor, master_application
	
	if thename = "platform"
		return master_platform
	endif
	switch master_platform
	case "sforce"
		return sforce_global_param(thename)
	case "connect"
		return connect_global_param(thename)
	case "amazon"
		return amazon_global_param(thename)
	case "quickbase"
		return quickbase_global_param(thename)
	case "azure"
		return azure_global_param(thename)
	case "desktop"
		return desktop_global_param(thename)
	endswitch
	return empty
endcode

Discover Entity -> retrieve the entity type of a object id
theid is a platform-dependent string representing the id of an object

blend_discover_entity("00130000000PmYq")
returns entity type of the object if found, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_discover_entity(theid)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_discover_entity(theid)
	case "connect"
		return connect_discover_entity(theid)
	case "amazon"
		return amazon_discover_entity(theid)
	case "quickbase"
		return quickbase_discover_entity(theid)
	case "azure"
		return azure_discover_entity(theid)
	case "desktop"
		return desktop_discover_entity(theid)
	endswitch
	return empty
endcode

Create Entity -> metadata interface for creating a new entity type,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of new entity consisting only of letters, numbers and "_"
label is a string that will be used for display for this new entity
plural is a string representing the plural form of the label parameter
perms is a xml parameter string containing the object-level CRUD permissions allowed
namefield is a string label of the field that will serve to name the individual objects

blend_create_entity("NewThing", "New Thing", "New Things", "truefalse", "Thing Name")
returns xml palette name of cached describe, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method,
entity should not already exists in this workspace.

code blend_create_entity(entity, label, plural, perms, namefield)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create_entity(entity, label, plural, perms, namefield)
	case "connect"
		return connect_create_entity(entity, label, plural, perms, namefield)
	case "amazon"
		return amazon_create_entity(entity, label, plural, perms, namefield)
	case "quickbase"
		return quickbase_create_entity(entity, label, plural, perms, namefield)
	case "azure"
		return azure_create_entity(entity, label, plural, perms, namefield)
	case "desktop"
		return desktop_create_entity(entity, label, plural, perms, namefield)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Update Entity -> metadata interface for updating a custom entity,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of new entity consisting only of letters, numbers and "_"
label is a string that will be used for display for this new entity
plural is a string representing the plural form of the label parameter
perms is a xml parameter string containing the object-level CRUD permissions allowed

blend_update_entity("NewThing", "New Thing", "New Things", "truefalse")
returns xml palette name of cached describe, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method,
entity should already exists in this workspace.

code blend_update_entity(entity, label, plural, perms)
	global master_platform, master_flavor, master_application
	local fields, values
	
	switch master_platform
	case "sforce"
		return sforce_update_entity(entity, label, plural, perms)
	case "connect"
		return connect_update_entity(entity, label, plural, perms)
	case "amazon"
		return amazon_update_entity(entity, label, plural, perms)
	case "quickbase"
		return quickbase_update_entity(entity, label, plural, perms)
	case "azure"
		return azure_update_entity(entity, label, plural, perms)
	case "desktop"
		return desktop_update_entity(entity, label, plural, perms)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Delete Entity -> metadata interface for deleting a custom entity,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of a custom entity consisting only of letters, numbers and "_"

blend_delete_entity("NewThing")
returns "OK" if successful, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method.
entity should already exists in this workspace.

code blend_delete_entity(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_delete_entity(entity)
	case "connect"
		return connect_delete_entity(entity)
	case "amazon"
		return amazon_delete_entity(entity)
	case "quickbase"
		return quickbase_delete_entity(entity)
	case "azure"
		return azure_delete_entity(entity)
	case "desktop"
		return desktop_delete_entity(entity)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Delete Field -> metadata interface for deleting a custom field,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of a custom or standard entity
fieldname is string name of a custom field

blend_delete_field("Account", "mynewfield")
returns "OK" if successful, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method.
entity and custom field should already exists in this workspace.

code blend_delete_field(entity, fieldname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_delete_field(entity, fieldname)
	case "connect"
		return connect_delete_field(entity, fieldname)
	case "amazon"
		return amazon_delete_field(entity, fieldname)
	case "quickbase"
		return quickbase_delete_field(entity, fieldname)
	case "azure"
		return azure_delete_field(entity, fieldname)
	case "desktop"
		return desktop_delete_field(entity, fieldname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Create Field -> metadata interface for creating a custom field,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of a custom or standard entity
fieldname is string name for the new custom field
fieldlabel is string label for the new custom field
fieldtype is string representing the type of the new field
additionaldata is xml parameter string including type-specific additional information

blend_create_field("Account", "newfield", "new field", "string", "80)
returns "OK" if successful, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method.
fieldname should not already exists on this object in this workspace.

code blend_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "connect"
		return connect_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "amazon"
		return amazon_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "quickbase"
		return quickbase_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "azure"
		return azure_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "desktop"
		return desktop_create_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Update Field -> metadata interface for updating a custom field,
check blend_global_param("createcustom") = true to see if this is supported
entity is a string name of a custom or standard entity
fieldname is string name for the custom field
fieldlabel is string label for the custom field
fieldtype is string representing the type of the field (internally changing this causes delete and add)
additionaldata is xml parameter string including type-specific additional information

blend_update_field("Account", "newfield", "new field", "string", "80)
returns "OK" if successful, otherwise platform or DFAC error, use blend_error()
requires global master_platform to be set prior to calling this method.
fieldname should already exists on this object in this workspace.

code blend_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "connect"
		return connect_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "amazon"
		return amazon_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "quickbase"
		return quickbase_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "azure"
		return azure_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	case "desktop"
		return desktop_update_field(entity, fieldname, fieldlabel, fieldtype, additionaldata)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

All Children -> retrieve all objects that reference the given entity
entity is a string name of a custom or standard entity

blend_all_children("Account") -> "Contact,AccountId\rOpportunity,AccountId\r..."
returns cr-delimited list of object and field tuples (separated by comma),
where the field is a reference field pointing to entity param passed, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_all_children(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_all_children(entity)
	case "connect"
		return connect_all_children(entity)
	case "amazon"
		return amazon_all_children(entity)
	case "quickbase"
		return quickbase_all_children(entity)
	case "azure"
		return azure_all_children(entity)
	case "desktop"
		return desktop_all_children(entity)
	endswitch
	return empty
endcode

All Parents -> retrieve all objects that the given entity references
entity is a string name of a custom or standard entity

blend_all_parents("Contact") -> "Account,AccountId\rContact,ReportsToId\r..."
returns cr-delimited list of tuples containing objects and the entity's field
that refers to it (separated by comma),
requires global master_platform to be set prior to calling this method.

code blend_all_parents(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_all_parents(entity)
	case "connect"
		return connect_all_parents(entity)
	case "amazon"
		return amazon_all_parents(entity)
	case "quickbase"
		return quickbase_all_parents(entity)
	case "azure"
		return azure_all_parents(entity)
	case "desktop"
		return desktop_all_parents(entity)
	endswitch
	return empty
endcode

Plural Entity -> retrieve plural form of the entity label
entity is a string name of a custom or standard entity

blend_plural_entity("Account")
returns plural label string (guessed based on entity if not found), empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_plural_entity(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_plural_entity(entity)
	case "connect"
		return connect_plural_entity(entity)
	case "amazon"
		return amazon_plural_entity(entity)
	case "quickbase"
		return quickbase_plural_entity(entity)
	case "azure"
		return azure_plural_entity(entity)
	case "desktop"
		return desktop_plural_entity(entity)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Label Entity -> retrieve the singular form of the entity label
entity is a string name of a custom or standard entity

blend_label_entity("Account")
returns label string, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_label_entity(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_label_entity(entity)
	case "connect"
		return connect_label_entity(entity)
	case "amazon"
		return amazon_label_entity(entity)
	case "quickbase"
		return quickbase_label_entity(entity)
	case "azure"
		return azure_label_entity(entity)
	case "desktop"
		return desktop_label_entity(entity)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Entity Anything -> retrieve parameter values from the entity schema
entity is a string name of a custom or standard entity
elementname is a string name of particular schema element of which the value is returned

blend_entity_anything("NewThing", "custom") -> checks if this is a custom object
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_entity_anything(entity, elementname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_entity_anything(entity, elementname)
	case "connect"
		return connect_entity_anything(entity, elementname)
	case "amazon"
		return amazon_entity_anything(entity, elementname)
	case "quickbase"
		return quickbase_entity_anything(entity, elementname)
	case "azure"
		return azure_entity_anything(entity, elementname)
	case "desktop"
		return desktop_entity_anything(entity, elementname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Edit URL -> retrieve the edit URL for a particular object (currently salesforce only)
entity is a string name of a custom or standard entity
theid is a platform-dependent id string of the object to edit

blend_edit_url("Account", "00130000000PmYq")
returns edit url for a specific id for linking
requires global master_platform to be set prior to calling this method.

code blend_edit_url(entity, theid)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_edit_url(entity, theid)
	case "connect"
		return connect_edit_url(entity, theid)
	case "amazon"
		return amazon_edit_url(entity, theid)
	case "quickbase"
		return quickbase_edit_url(entity, theid)
	case "azure"
		return azure_edit_url(entity, theid)
	case "desktop"
		return desktop_edit_url(entity, theid)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Retrieve -> retrieve object field values given ids
entity is a string name of a custom or standard entity
idlist is a comma-delimited list of platform-dependent id strings of the objects to retrieve
fieldlist is a comma-delimited list of fields that are to be retrieved,

blend_retrieve("Account", "00130000000PmYq,00130000000PmAA", "Name,AnnualRevenue")
returns array of items (xml form) containing a value for each requested field if ids are found,
platform-specific errors if occurred, or empty if none of the ids are found
requires global master_platform to be set prior to calling this method.

code blend_retrieve(entity, idlist, fieldlist)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_retrieve(entity, idlist, fieldlist)
	case "connect"
		return connect_retrieve(entity, idlist, fieldlist)
	case "amazon"
		return amazon_retrieve(entity, idlist, fieldlist)
	case "quickbase"
		return quickbase_retrieve(entity, idlist, fieldlist)
	case "azure"
		return azure_retrieve(entity, idlist, fieldlist)
	case "desktop"
		return desktop_retrieve(entity, idlist, fieldlist)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Filter -> retrieve object field values for objects that match the given filter criteria
entity is a string name of a custom or standard entity
fieldlist is a comma-delimited list of fields that are to be retrieved,
filterstring is a platform-independent (coverted by platform layer) field-level filter
check values like "simplefilter" and "maxfilter" via blend_global_param() for supported combinations

blend_filter("Account", "Name,AnnualRevenue", "Name != 'DreamFactory' AND AnnualRevenue >= '100000'")
returns array of items (xml form) containing a value for each requested field if items are found that match filter,
platform-specific errors if occurred, or empty if no filter matches are found
requires global master_platform to be set prior to calling this method.

code blend_filter(entity, fieldlist, filterstring)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_filter(entity, fieldlist, filterstring)
	case "connect"
		return connect_filter(entity, fieldlist, filterstring)
	case "amazon"
		return amazon_filter(entity, fieldlist, filterstring)
	case "quickbase"
		return quickbase_filter(entity, fieldlist, filterstring)
	case "azure"
		return azure_filter(entity, fieldlist, filterstring)
	case "desktop"
		return desktop_filter(entity, fieldlist, filterstring)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Filter with Limit -> same as filter, but returns up to a limit of items
entity is a string name of a custom or standard entity
fieldlist is a comma-delimited list of fields that are to be retrieved,
filterstring is a platform-independent (coverted by platform layer) field-level filter
check values like "simplefilter" and "maxfilter" via blend_global_param() for supported combinations
sizelimit is a integer greater than zero for the maximum number of items to return

blend_filter_limit("Account", "Name,AnnualRevenue", "Name != 'DreamFactory'", 10)
returns array of 'sizelimit' or less items (xml form) containing a value for each requested field,
if items are found that match filter, platform-specific errors if occurred,
or empty if no filter matches are found
requires global master_platform to be set prior to calling this method.

code blend_filter_limit(entity, fieldlist, filterstring, sizelimit)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_filter_limit(entity, fieldlist, filterstring, sizelimit)
	case "connect"
		return connect_filter_limit(entity, fieldlist, filterstring, sizelimit)
	case "amazon"
		return amazon_filter_limit(entity, fieldlist, filterstring, sizelimit)
	case "quickbase"
		return quickbase_filter_limit(entity, fieldlist, filterstring, sizelimit)
	case "azure"
		return azure_filter_limit(entity, fieldlist, filterstring, sizelimit)
	case "desktop"
		return desktop_filter_limit(entity, fieldlist, filterstring, sizelimit)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Search -> retrieve object field values for objects that match the given filter criteria
used primarily on name-fields and contact info fields like email, phone, etc.
entity is a string name of a custom or standard entity
fieldlist is a comma-delimited list of fields that are to be retrieved,
searchstring is a simple string used to compare against field values in the objects
wherename is "all", "name", "phone", or "email"

blend_search("User", "id", "Bob", "all")
returns array of items (xml form) containing a value for each requested field
of items found that match search, platform-specific errors if occurred, or empty
requires global master_platform to be set prior to calling this method.

code blend_search(entity, fieldlist, searchstring, wherename)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_search(entity, fieldlist, searchstring, wherename)
	case "connect"
		return connect_search(entity, fieldlist, searchstring, wherename)
	case "amazon"
		return amazon_search(entity, fieldlist, searchstring, wherename)
	case "quickbase"
		return quickbase_search(entity, fieldlist, searchstring, wherename)
	case "azure"
		return azure_search(entity, fieldlist, searchstring, wherename)
	case "desktop"
		return desktop_search(entity, fieldlist, searchstring, wherename)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Delete -> delete objects that match given ids
entity is a string name of a custom or standard entity
idlist is a comma-delimited list of platform-dependent id strings of the objects to delete

blend_delete("Account", "00130000000PmYq,00130000000PmAA")
returns "OK" or platform-specific errors if occurred
requires global master_platform to be set prior to calling this method.

code blend_delete(entity, idlist)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_delete(entity, idlist)
	case "connect"
		return connect_delete(entity, idlist)
	case "amazon"
		return amazon_delete(entity, idlist)
	case "quickbase"
		return quickbase_delete(entity, idlist)
	case "azure"
		return azure_delete(entity, idlist)
	case "desktop"
		return desktop_delete(entity, idlist)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Create -> creates a new object for the given entity with the given field values
entity is a string name of a custom or standard entity
fields is an array of fields for the given entity
values is an array of values for the given fields

blend_create("Account", "Name", "My Account")
returns platform-specific id of object created, otherwise platform-specific errors
requires global master_platform to be set prior to calling this method.

code blend_create(entity, fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create(entity, fields, values)
	case "connect"
		return connect_create(entity, fields, values)
	case "amazon"
		return amazon_create(entity, fields, values)
	case "quickbase"
		return quickbase_create(entity, fields, values)
	case "azure"
		return azure_create(entity, fields, values)
	case "desktop"
		return desktop_create(entity, fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Create Begin, Middle, End -> allows batching request to create multiple objects at a time
currently only one entity can be batched at a time, batching limits are handled by the platform
entity is a string name of a custom or standard entity
fields is an array of fields for the given entity
values is an array of values for the given fields

blend_create_begin("Account", "Name", "My Account")
blend_create_middle("Name", "My Account")
blend_create_end()
returns "OK" or errors for the begin and middle calls,
comma-delimited list of platform-specific ids, or errors for the end calls.
requires global master_platform to be set prior to calling this method.

code blend_create_begin(entity, fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create_begin(entity, fields, values)
	case "connect"
		return connect_create_begin(entity, fields, values)
	case "amazon"
		return amazon_create_begin(entity, fields, values)
	case "quickbase"
		return quickbase_create_begin(entity, fields, values)
	case "azure"
		return azure_create_begin(entity, fields, values)
	case "desktop"
		return desktop_create_begin(entity, fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

code blend_create_middle(fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create_middle(fields, values)
	case "connect"
		return connect_create_middle(fields, values)
	case "amazon"
		return amazon_create_middle(fields, values)
	case "quickbase"
		return quickbase_create_middle(fields, values)
	case "azure"
		return azure_create_middle(fields, values)
	case "desktop"
		return desktop_create_middle(fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

code blend_create_end()
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_create_end()
	case "connect"
		return connect_create_end()
	case "amazon"
		return amazon_create_end()
	case "quickbase"
		return quickbase_create_end()
	case "azure"
		return azure_create_end()
	case "desktop"
		return desktop_create_end()
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Update -> updates an existing object for the given entity with the given field values
entity is a string name of a custom or standard entity
theid is a platform-specific object id
fields is an array of fields for the given entity
values is an array of values for the given fields

blend_update("Account", "00130000000PmYq", "Rating", "Hot")
returns "OK", otherwise platform-specific errors
requires global master_platform to be set prior to calling this method.

code blend_update(entity, theid, fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_update(entity, theid, fields, values)
	case "connect"
		return connect_update(entity, theid, fields, values)
	case "amazon"
		return amazon_update(entity, theid, fields, values)
	case "quickbase"
		return quickbase_update(entity, theid, fields, values)
	case "azure"
		return azure_update(entity, theid, fields, values)
	case "desktop"
		return desktop_update(entity, theid, fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Update Begin, Middle, End -> allows batching request to update multiple objects at a time
currently only one entity can be batched at a time, batching limits are handled by the platform
entity is a string name of a custom or standard entity
theid is a platform-specific object id
fields is an array of fields for the given entity
values is an array of values for the given fields

blend_update_begin("Account", "00130000000PmYq", "Rating", "Cold")
blend_update_middle("00130000000PmYs", "Rating", "Warm")
blend_update_end()
returns "OK" or errors for the begin and middle and end calls
requires global master_platform to be set prior to calling this method.

code blend_update_begin(entity, theid, fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_update_begin(entity, theid, fields, values)
	case "connect"
		return connect_update_begin(entity, theid, fields, values)
	case "amazon"
		return amazon_update_begin(entity, theid, fields, values)
	case "quickbase"
		return quickbase_update_begin(entity, theid, fields, values)
	case "azure"
		return azure_update_begin(entity, theid, fields, values)
	case "desktop"
		return desktop_update_begin(entity, theid, fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

code blend_update_middle(theid, fields, values)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_update_middle(theid, fields, values)
	case "connect"
		return connect_update_middle(theid, fields, values)
	case "amazon"
		return amazon_update_middle(theid, fields, values)
	case "quickbase"
		return quickbase_update_middle(theid, fields, values)
	case "azure"
		return azure_update_middle(theid, fields, values)
	case "desktop"
		return desktop_update_middle(theid, fields, values)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

code blend_update_end()
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_update_end()
	case "connect"
		return connect_update_end()
	case "amazon"
		return amazon_update_end()
	case "quickbase"
		return quickbase_update_end()
	case "azure"
		return azure_update_end()
	case "desktop"
		return desktop_update_end()
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Describe -> check if given entity exists on this platform
typically used internally to cache schema information about the given entity
entity is a string name of a custom or standard entity

blend_describe("Contact")
returns "OK" if the entity exists and has available schema, errors otherwise
requires global master_platform to be set prior to calling this method.

code blend_describe(entity)
	local results
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		results = sforce_describe(entity)
		if sforce_error(results)
			return results
		endif
		return "OK"
	case "connect"
		results = connect_describe(entity)
		if connect_error(results)
			return results
		endif
		return "OK"
	case "amazon"
		results = amazon_describe(entity)
		if amazon_error(results)
			return results
		endif
		return "OK"
	case "quickbase"
		results = quickbase_describe(entity)
		if quickbase_error(results)
			return results
		endif
		return "OK"
	case "azure"
		results = azure_describe(entity)
		if azure_error(results)
			return results
		endif
		return "OK"
	case "desktop"
		results = desktop_describe(entity)
		if desktop_error(results)
			return results
		endif
		return "OK"
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

User Info -> retrieve information about the current user

blend_user_info()
returns field and value information in XML format about the current user, or errors
requires global master_platform to be set prior to calling this method.

code blend_user_info()
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_user_info()
	case "connect"
		return connect_user_info()
	case "amazon"
		return amazon_user_info()
	case "quickbase"
		return quickbase_user_info()
	case "azure"
		return azure_user_info()
	case "desktop"
		return desktop_user_info()
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Field to Label -> retrieves label value of a given field in a given entity
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field

blend_field_label("Account", "Name") -> "Account Name"
returns label value of the requested field, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_field_label(entity, fieldname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_field_label(entity, fieldname)
	case "connect"
		return connect_field_label(entity, fieldname)
	case "amazon"
		return amazon_field_label(entity, fieldname)
	case "quickbase"
		return quickbase_field_label(entity, fieldname)
	case "azure"
		return azure_field_label(entity, fieldname)
	case "desktop"
		return desktop_field_label(entity, fieldname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Label to Field -> retrieves field name that has the given label in a given entity
entity is a string name of a custom or standard entity
labelname is a string label of a custom or standard field

blend_field_label("Account", "Account Name") -> "Name"
returns field name of the requested field having matching label, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_label_field(entity, labelname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_label_field(entity, labelname)
	case "connect"
		return connect_label_field(entity, labelname)
	case "amazon"
		return amazon_label_field(entity, labelname)
	case "quickbase"
		return quickbase_label_field(entity, labelname)
	case "azure"
		return azure_label_field(entity, labelname)
	case "desktop"
		return desktop_label_field(entity, labelname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Field Locked -> Check for availability of entity or field level access
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field
accessflag is a string of values "create, read, update, delete, or edit" for entity access
if a fieldname is specified, only "read and update" make sense

blend_field_locked("Account", "Name", "update") -> "Name"
returns boolean where true if the access is allowed, false otherwise
requires global master_platform to be set prior to calling this method.

code blend_field_locked(entity, fieldname, accessflag)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_field_locked(entity, fieldname, accessflag)
	case "connect"
		return connect_field_locked(entity, fieldname, accessflag)
	case "amazon"
		return amazon_field_locked(entity, fieldname, accessflag)
	case "quickbase"
		return quickbase_field_locked(entity, fieldname, accessflag)
	case "azure"
		return azure_field_locked(entity, fieldname, accessflag)
	case "desktop"
		return desktop_field_locked(entity, fieldname, accessflag)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Field Anything -> retrieve schema parameter values of the given field for a given entity
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field
elementname is a string of schema element in a given field or entity
commonly used as "type" or "custom", etc.

blend_field_anything("Account", "Rating", "type") -> "picklist"
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_field_anything(entity, fieldname, elementname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_field_anything(entity, fieldname, elementname)
	case "connect"
		return connect_field_anything(entity, fieldname, elementname)
	case "amazon"
		return amazon_field_anything(entity, fieldname, elementname)
	case "quickbase"
		return quickbase_field_anything(entity, fieldname, elementname)
	case "azure"
		return azure_field_anything(entity, fieldname, elementname)
	case "desktop"
		return desktop_field_anything(entity, fieldname, elementname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Reference List -> retrieves list of entity types the given field references
this should be used instead of blend_field_anything(entity, fieldname, "referenceTo")
which currently only returns the first one on platforms where polymorphic references are available
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field

blend_referenceto_list("Contact", "OwnerId") -> "User"
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_referenceto_list(entity, fieldname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_referenceto_list(entity, fieldname)
	case "connect"
		return connect_field_anything(entity, fieldname, "referenceTo")
	case "amazon"
		return amazon_field_anything(entity, fieldname, "referenceTo")
	case "quickbase"
		return quickbase_field_anything(entity, fieldname, "referenceTo")
	case "azure"
		return azure_field_anything(entity, fieldname, "referenceTo")
	case "desktop"
		return desktop_field_anything(entity, fieldname, "referenceTo")
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Picklist Values -> retrieves picklist values or value labels for a given field in a given entity
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field
label is a boolean where true means retrieve the labels of the values (where supported),
false means retrieve the raw values

blend_pick_list("Account", "Rating", false) -> "Hot\rWarm\rCold"
returns cr-delimited list of values or labels of the given picklist field, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_pick_list(entity, fieldname, label)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_pick_list(entity, fieldname, label)
	case "connect"
		return connect_pick_list(entity, fieldname, label)
	case "amazon"
		return amazon_pick_list(entity, fieldname, label)
	case "quickbase"
		return quickbase_pick_list(entity, fieldname, label)
	case "azure"
		return azure_pick_list(entity, fieldname, label)
	case "desktop"
		return desktop_pick_list(entity, fieldname, label)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Picklist Anything -> retrieve schema parameter values for the given picklist field value
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field
valuename is a string representing the particular picklist value the element is to be retrieved from.
elementname is a schema element to be retrieved, such as "default", etc.

blend_pick_anything("Account", "Rating", "Hot", "default")
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_pick_anything(entity, fieldname, valuename, elementname)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_pick_anything(entity, fieldname, valuename, elementname)
	case "connect"
		return connect_pick_anything(entity, fieldname, valuename, elementname)
	case "amazon"
		return amazon_pick_anything(entity, fieldname, valuename, elementname)
	case "quickbase"
		return quickbase_pick_anything(entity, fieldname, valuename, elementname)
	case "azure"
		return azure_pick_anything(entity, fieldname, valuename, elementname)
	case "desktop"
		return desktop_pick_anything(entity, fieldname, valuename, elementname)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

All Entities -> retrieve all entities available for use in this workspace

blend_all_entities("user_id")
returns comma-delimited list of entity names, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_all_entities()
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_all_entities()
	case "connect"
		return connect_all_entities()
	case "amazon"
		return amazon_all_entities()
	case "quickbase"
		return quickbase_all_entities()
	case "azure"
		return azure_all_entities()
	case "desktop"
		return desktop_all_entities()
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

All Fields -> retrieve all available fields for a given entity
entity is a string name of a custom or standard entity

blend_all_fields("Account")
returns comma-delimited list of field names, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_all_fields(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_all_fields(entity)
	case "connect"
		return connect_all_fields(entity)
	case "amazon"
		return amazon_all_fields(entity)
	case "quickbase"
		return quickbase_all_fields(entity)
	case "azure"
		return azure_all_fields(entity)
	case "desktop"
		return desktop_all_fields(entity)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Name Field -> retrieve the naming field for a given entity
entity is a string name of a custom or standard entity

blend_name_field("Account") -> "Name"
returns field name for the assigned naming field, "Id" otherwise (for entities that don't support naming)
requires global master_platform to be set prior to calling this method.

code blend_name_field(entity)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_name_field(entity)
	case "connect"
		return connect_name_field(entity)
	case "amazon"
		return amazon_name_field(entity)
	case "quickbase"
		return quickbase_name_field(entity)
	case "azure"
		return azure_name_field(entity)
	case "desktop"
		return desktop_name_field(entity)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Sync Value to ID -> retrieves the object with the given sync value
entity is a string name of a custom or standard entity
thekey is a string sync value, the sync values are typically id values and are used when
tracking objects that have been imported or exported to a different platform or workspace

blend_sync2id("Account", "az00130000000123")
returns id value of the object, empty otherwise
requires global master_platform to be set prior to calling this method.
Not currently supported on salesforce.com

code blend_sync2id(entity, thekey)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_sync2id(entity, thekey)
	case "connect"
		return connect_sync2id(entity, thekey)
	case "amazon"
		return amazon_sync2id(entity, thekey)
	case "quickbase"
		return quickbase_sync2id(entity, thekey)
	case "azure"
		return azure_sync2id(entity, thekey)
	case "desktop"
		return desktop_sync2id(entity, thekey)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

ID to Sync Value -> retrieves the sync value of the object with the given id
entity is a string name of a custom or standard entity
theid is a platform-specific id value

blend_id2sync("Account", "00130000000PmYq")
returns sync value assigned to the object, empty otherwise
requires global master_platform to be set prior to calling this method.
Not currently supported on salesforce.com

code blend_id2sync(entity, theid)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_id2sync(entity, theid)
	case "connect"
		return connect_id2sync(entity, theid)
	case "amazon"
		return amazon_id2sync(entity, theid)
	case "quickbase"
		return quickbase_id2sync(entity, theid)
	case "azure"
		return azure_id2sync(entity, theid)
	case "desktop"
		return desktop_id2sync(entity, theid)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Save Sync Value -> assigns a sync value to an object
entity is a string name of a custom or standard entity
theid is a platform-specific id value
thekey is a string sync value

blend_savesync("Account", "00130000000PmYq", "az000123009546")
returns "OK", errors otherwise
requires global master_platform to be set prior to calling this method.
Not currently supported on salesforce.com

code blend_savesync(entity, theid, thekey)
	global master_platform, master_flavor, master_application
	
	switch master_platform
	case "sforce"
		return sforce_savesync(entity, theid, thekey)
	case "connect"
		return connect_savesync(entity, theid, thekey)
	case "amazon"
		return amazon_savesync(entity, theid, thekey)
	case "quickbase"
		return quickbase_savesync(entity, theid, thekey)
	case "azure"
		return azure_savesync(entity, theid, thekey)
	case "desktop"
		return desktop_savesync(entity, theid, thekey)
	endswitch
	return "DFAC Error [NO_PLATFORM] " @ title("There is no platform for this application.")
endcode

Is Required Field -> retrieves whether the given field is required for create or update requests
entity is a string name of a custom or standard entity
fieldname is a string name of a custom or standard field
isCreate is a boolean designating whether the fields are required for
create (true) or update (false) requests

blend_req_field("user_id")
returns value of the requested parameter, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_req_field(entity, fieldname, isCreate)
	global master_platform
	
	if fieldname = "Id"
		return false
	endif
	if blend_field_anything(entity, fieldname, "nillable")
		return false
	endif
	if (master_platform = "sforce") and blend_field_anything(entity, fieldname, "defaultedOnCreate")
		return false
	endif
	
	if blend_field_locked(entity, fieldname, "update")
		if not isCreate
			return false
		endif
		if master_platform = "sforce"
			if not blend_field_anything(entity, fieldname, "createable")
				return false
			endif
		endif				
	endif
	return true
endcode

Get Required Fields -> retrieves all fields of the given entity that are required for create or update requests
entity is a string name of a custom or standard entity
isCreate is a boolean designating whether the fields are required for
create (true) or update (false) requests

blend_req_fields("Account", true) -> "Name"
returns comma-delimited list of field names, empty otherwise
requires global master_platform to be set prior to calling this method.

code blend_req_fields(entity, isCreate)
	global master_platform
	local allfields, reqfields, fieldname
	
	allfields = blend_all_fields(entity)
	reqfields = empty
	for i = 1 to stringitemget(allfields, comma)
		fieldname = stringlistget(allfields, comma, i)
		if blend_req_field(entity, fieldname, isCreate)
			if reqfields != empty
				reqfields @= comma
			endif
			reqfields @= fieldname
		endif
	endfor
	return reqfields
endcode
©2010 DreamFactory Software, Inc.     Privacy Policy | Terms of Use | DreamFactory is a registered trademark of DreamFactory Software, Inc. All Rights Reserved.