Retrieving empty values from multi value string in user profile custom properties
Hi,
I created a webpart to save and retrieve data from custom properties. I use the code below to get the stored data:
for (int i = 0; i < profile[property].Count; i++)
Item = profile[property][i] == null ? string.Empty : profile[property][i].ToString();
list.Add(Regex.Split(Item, @"\,\#"));
Nothinig special about it.
In my development environment, it works fine. The problem is in my UAT environment. I'm facing an issue that i hope someone has been through. When the custom property is a multi value string type, it returns a empty string. I tested with HTML and single
value fields and it works fine.
Independently of the field type, it saves the data all right.
Can anyone help me?
Thanks!!
Thanks, Chitvan Jain.
I did as you suggested, but nothing changed. The problem is that profile[propname] comes already blank when using multi value property, even if there is data to be retrieved.
One funny thing is that, somehow the code manages to count the number of values there is in the property. Only the data is missing. We can see the exact number of column, cause i check if there's the right number of data, if there isn't, i add up a empty
string on the grid cell, but only for viewing. The empty string is not stored in the property.
Similar Messages
-
Person or Group colum in the SharePoint list retrieves empty value for Mobile phone property
Person or Group colum in the SharePoint list retrieves empty Mobile phone for some users although thoses users have Mobile Phone values in the User Proifles. This happens only for some users. For some users it shows Mobile phone for
some days and after some days it dess not show Mobile Phone though Mobile Phone entries are in the User Profiles for those users.
Appreciate any help to fix this.
Thanks in Advance!
Narayana Reddy
Narayana Reddy GHi Narayana,
According to your description, my understanding is that the person or group column retrieved an empty value for Mobile phone in SharePoint 2010.
Please go to the hidden User Information List using
http://<SiteCollectionUrl>/_catalogs/users/detail.aspx , check the value of Mobile phone.
Please go to CA->Monitoring->Review job definitions, scroll to User Profile to SharePoint Full Synchronization
and
User Profile to SharePoint Quick Synchronization, make sure they work well.
In addition, please take a look at :
http://donalconlon.wordpress.com/2012/03/02/sharepoint-user-information-list-is-not-being-updated/
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
Files missing from desktop after deleting a user profile that was created on there.
I downloaded and installed firefox and it asked me to create a user profile, but it could not save in the default location. I chose to create the profile on the desktop as a test and that worked. However, after deleting that user profile, all of the items on my desktop were removed and cannot be located. The files are not in my trashbin and when I do a search, it says the file cannot be located. I have Windows 7.
You shouldn't create a profile and choose an existing folder.<br />
You should always specify an empty folder and if you didn't do that then you should never remove the files when you remove such a profile because all files in it will be removed and not just the files created by Firefox.
See:
*http://kb.mozillazine.org/Files_created_on_startup -
Steps to reproduce bug:
1. edit .pdf file from MS network (i.e a share).
1.1 Browsing the network.
1.2 Once that the file is found.
1.3 Select the file, right click and select edit with Adobe Acrobat".
2. save changes.
Results:
I get message box "document could not save because write access was not granted. only read"
Expected results: I have to save the file because the user has all rights file’s security.
Can you help me ?
Thanks in advance
EnricoFirst, you should ask in Acrobat
The Cloud forum is not about using individual programs
The Cloud forum is about the Cloud as a delivery & install process
If you will start at the Forums Index https://forums.adobe.com/welcome
You will be able to select a forum for the specific Adobe product(s) you use
Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll
Second, different program, but what helps with SOME permission errors is in the link below
Run as Administrator http://forums.adobe.com/thread/969395 (Encore + "All" Premiere) -
Password expire date back to 2011 from 2012 after assigned a user profile
Friends,
I created a profile test as
COMPOSITE_LIMIT UNLIMITED
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
LOGICAL_READS_PER_SESSION UNLIMITED
LOGICAL_READS_PER_CALL UNLIMITED
IDLE_TIME 60
CONNECT_TIME UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS 5
PASSWORD_LIFE_TIME 120
PASSWORD_REUSE_TIME 60
PASSWORD_REUSE_MAX 30
PASSWORD_VERIFY_FUNCTION NULL
PASSWORD_LOCK_TIME 1
PASSWORD_GRACE_TIME 7;
the user default profile default PASSWORD_LIFE_TIME is 180 and password expired date is 1/7/2012. the test account was created in 7/11/2011.
Now I assign test user to test profile successfully.
However. expire date becomes 11/8/2011 1 from 1/7/2012 by select dba_users
which wrong is in my profile or somewhere?
As I think, the account password expired should be start after assigned new profile with PASSWORD_LIFE_TIME. but is seems expire date is start from original account created date.
Thanks
newdba
Edited by: Oradb on May 24, 2012 1:56 PMI would think the expire time would be based on the last password change time which Oracle stores in the rdbms base table for user information (user$). Find a second user, alter the password, check the expire date, then assign the user to the new profile, re-check the expiration date. Post back. Behavior may vary between releases so include full Oracle version of test.
HTH -- Mark D Powell -- -
When voting, survey Sharepoint 2013, there is a field created by whom. But the name is not enough. Necessary to add the department name of the profile data in the exported list excel.
Hi,
The OOTB feature “Export to Spreadsheet” won’t contain the department in the exported report, we will need to create a custom one programmatically.
We can use SharePoint Object Model to retrieve the data from the Survey and the User Profile Service, then generate an Excel Spreadsheet with the data we need.
SharePoint Object Model -
SPListItem class
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx
Add, Update and Delete List Items Programmatically in SharePoint
http://www.mindfiresolutions.com/Add-Update-and-Delete-List-Items-Programmatically-in-Sharepoint-372.php
More information about
SharePoint Object Model:
http://msdn.microsoft.com/en-us/library/ms473633.ASPX
How to: Work with user profiles and organization profiles by using the server object model in SharePoint 2013
http://msdn.microsoft.com/en-us/library/office/jj163142(v=office.15).aspx
For about
generating an Excel document:
http://www.codeproject.com/Articles/20228/Using-C-to-Create-an-Excel-Document
Or you can post another question to
Excel for Developers for about creating an Excel file programmatically:
http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
Feel free to reply if there are still any questions.
Best regards
Patrick Liang
TechNet Community Support -
Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD
I configured the user profile service application and run Sync and user profiles and its properties returned from Active directory but when I want to read it pragmatically it returns null values.
this is my code...
void runQueryButton_Click(object sender, EventArgs e)
// Get the My Sites site collection, ensuring proper disposal
using (SPSite mySitesCollection = new SPSite("http://sp/my"))
//Get the user profile manager
SPServiceContext context = SPServiceContext.GetContext(mySitesCollection);
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile profile = profileManager.GetUserProfile("Contoso\\user");
foreach (Property prop in profileManager.Properties)
// if (prop.Name == "Department")
resultsLabel.Text += prop.DisplayName + ":" + profile[prop.Name].Value + "<br />"; ;Hi,
Please try with the following code
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain);
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (Property prop in profileManager.Properties)
// if (prop.Name == "Department")
resultsLabel.Text += prop.DisplayName
+ ":" + profile[prop.Name].Value + "<br />"; ;
Thanks,
Vivek
Please vote or mark your question answered, if my reply helps you -
Import a filed value from custom database into User Profile using BCS
Hi,
I have a custom DB in SQL with couple of columns.
I need to import one of the fields (userid) into user profile - custom property.
Please guide me to make it done.
My direction seems wrong..since I am new to user profile-BCS concepts.
I created a custom property in user profile services, while "configure synchronization connections', I clicked on new connection.
Type: Business connectivity services, selected
It needs external content type.
I opened CA through designer, clicked on External Content type, I am able to connect SQLDB and related fields.
But, I am not sure what to be done?? How to make my task completed.
Guide me, somebody, please!!
- GEMThis should create the External Content Type
Open SharePoint Designer
Choose the Site where you want the External Content Type to be created
Under Site Objects -> Click External Content Types
In the Ribbon -> Click External Content Types to create a New one
Provide a name for your ECT
Click ‘Click here to discover external data sources and define operations’
Click Add Connection, under Data Source Type choose SQL Server
Provide the connection properties to your SQL Server
Under Data Source Explorer, Expand the tables folder and choose the table you want to connect to
Right Click the Table Name and create a New Read Item Operation
Under Input Parameters, Select the Primary Key of your table and verify that it is map as the identifier. This is important as this will be the column that will be used to sync BCS data to SharePoint. Click on Finish
Right Click the Table Name again and create a New Read List Operation. Follow the steps on K
OPTIONAL: Once done you can create an external Lists based on the content type to verify if you are able to pull data from your External Source
You can verify if the list is created by going to the site where you have deployed the External List. If you encounter a “Access denied by Business Data Connectivity, you can resolve this by going to Central Administration -> Application Management ->
Manage Service Applications -> Business Data Connectivity Service, choose the External Content Type you have created -> Click Set Object Permissions -> Add the account that your are using and Set ‘Execute & Set Permissions’. Refresh the external
list page.
This will create the connection between the BCS properties and the Custom User Properties which are mapped to BCS.
To create a synchronization connection follow the steps below
Go to Application Management -> Manage Service Application -> User Profile Service -> Configure Synchronization Connections
Click Create new Connection
Provide a connection name for your connection
Under Type, choose Business Data Connectivity
Under Business Data Connectivity Entity, choose the External Content Type created on the BCS Step
Choose the property to identity the 1:1 mapping, this is a unique column that should exist on both the BCS Data and the SharePoint User Profile Properties.
This part will create the Custom User Profile Property to hold the BCS Data
Go to Central Administration
Under Application Management click Manage Service Application
Click User Profile Service Application
Click Manage User Properties then select New Property
Fill the necessary fields
Under Add New Mapping, select the BCS Sync connection you have created above and the field from SQL where you want to map this property
Run Profile Synchronization
Artificial intelligence can never beat natural stupidity. -
Change documents for default values in user profiles
Dear Experts,
Please let me know if there are any tables to find the changes that have been made to the default values in a user profile.
Regards,
Lakshmi.Hi,
as the defaults are not considered as critical, changes are not recorded in change documents.
b.rgds, Bernhard -
SAP APO User Profile Parameter Values
Hello All,
I would like to know where can I find parameter values in the User Profile Setting.
I could find many useful "Parameter Ids" but don't know what values needs to go in it. Is there a technical document some where that mentions values that needs to used?
Few examples
/SAPAPO/CDPS_OPTGUI1 (Time Unit of Value Display)
/SAPAPO/SDP_GRAPH_TB (Hide/Display Toolbar Options for Graphic)
Please advise.
Thanks,
SanjuHello Sanju,
In most cases these parameters have values X or blank... Per note 1084550 you will need to set the user parameter
for /SAPAPO/SDP_GRAPH_TB to X .
Regards,
Ade -
Get all values from multi select in a servlet
Hello,
I have a multi <select> element in a HTML form and I need to retrieve the values of ALL selected options of this <select> element in a servlet.
HTML code snippet
<select name="elName" id="elName" multiple="multiple">
Servlet code snippet
response.setContentType("text/html");
PrintWriter out = null;
out = response.getWriter();
String output = "";
String[] str = request.getParameterValues("elName");
for(String s : str) {
output += s + ":";
output = output.substring(0, output.length()-1); // cut off last deliminator
out.println(output);But even when selecting multiple options, the returned text only ever contains the value of the first selected option in the <select>
What am I doing wrong? I'm fairly new to servlets
Edited by: Irish_Fred on Feb 4, 2010 12:43 PM
Edited by: Irish_Fred on Feb 4, 2010 12:44 PM
Edited by: Irish_Fred on Feb 4, 2010 2:14 PM
Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
Edited by: Irish_Fred on Feb 4, 2010 2:32 PMI am using AJAX.
I will show you how I'm submitting the <select> values by showing you the flow of code:
This is the HTML code for the <select> tag and the button that sends the form data:
<form name="formMain" id="formMain" method="POST">
<input type="button" id="addOpts" name="addOpts" value="Add Options" style="width:auto; visibility:hidden" onClick="jsObj.addOptions('servletName', document.getElementById('elName'))">
<br>
<select name="elName" id="elName" multiple="multiple" size="1" onChange="jsObj.checkSelected()">
<option value="0"> - - - - - - - - - - - - - - - - </option>
</select>
</form>Note that the "visibility:hidden" part of the button style is set to "visible" when at least one option is selected
Note that "jsObj" relates to a java script object that has been created when the web app starts ( The .js file is included in the .jsp <head> tag )
The following code is taken from the file: "jsObj.js"
jsObj = new jsObj();
function jsObj() {
//=================================================
this.addOptions = function(url, elName) {
var theForm = document.getElementById('formMain');
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
url += this.buildQueryString(theForm.name);
xmlhttp.open("POST",url,true);
xmlhttp.send(null);
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4) { // 4 = The request is complete
alert(xmlhttp.responseText);
//=================================================
this.buildQueryString = function(formName) {
var theForm = document.forms[formName];
var qs = '';
for (var i=0; i<theForm.elements.length; i++) {
if (theForm.elements.name!='') {
qs+=(qs=='')? '?' : '&';
qs+=theForm.elements[i].name+'='+escape(theForm.elements[i].value);
return qs;
//=================================================
}And this is a code snippet from the "servletName" servlet:public synchronized void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,IOException {
PrintWriter out = null;
try {
response.setContentType("text/html");
out = response.getWriter();
String output = "";
String[] values = request.getParameterValues("elName");
for(String s : values) {
output += s + ":";
output = output.substring(0, output.length()-1); // cut off last delimitor
out.println(output);
} catch (Exception e) {
}So anyway, everthing compiles / works, except for the fact that I'm only getting back the first selected <option> in the 'elName' <select> tag whenever I select multiple options
Edited by: Irish_Fred on Feb 7, 2010 10:53 AM -
Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Todd,
Let me try to explain you this time. I have a text field in a TiledViewBean.
When I display the page, the text field
html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say
five times/rows with same name.
The html tags look like this.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
When the form is submitted, I want to get the text field values using the
method getTbFieldName().getValues() which
returns an array object[]. This is in case where my TiledViewBean is not
bound and it is working fine.
Now in case when my TiledView is bound to a model, it creates the html tags
as follows.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[1].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[2].tbFieldName" value=""
maxlength=9 size=13>
Now when I say getTbFieldName().getValues() it returns only the first
element values in the object[] and the rest of the
values are null.
May be we need to create a utility method do get these values from
requestContext.
raju.
----- Original Message -----
From: Todd Fast <toddwork@c...>
Sent: Saturday, July 07, 2001 3:52 AM
Subject: Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Raju.--
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing likeI'm afraid I don't understand your point--can you please clarify? Do you
mean "value" instead of "name"?
What are you trying to do? What behavior are you expecting but notseeing?
>
Without further clarification, I can say that the setValues() methodsNEVER
populates data on multiple rows of a (dataset) model, nor does it affect
multiple fields on the same row. Perhaps what you are seeing is theeffect
of default values. Model that derive from DefaulModel have the ability to
carry forward the values set on the first row to other rows in lieu ofdata
in those other rows. This behavior is for pure convenience and can be
turned off, and it is turned off for the SQL-based models.
Todd
[email protected]Hi,
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing like
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[0].tbFieldValue
in which case, the getValues() method works fine.
But in case where the tiled view is bound to a model, it populates
with different field names such as,
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[1].tbFieldValue
in this case, the getValues() doesn't work. Any soultion to this?
We are using Moko 1.1.1.
thanks in advance,
raju.
--- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
Does anyone know of is there a single method to get all values of a
display
field in a tiled view without having to iterate through all the
values ie
resetTileIndex() / nextTile() approach.
ie Something that returns an Object[] or Vector just like ND returned a
CspVector. I tried using the getValues() methods but that allways returns
a
single element array containing the first element.
(I think now, that method is used for multi selecteable ListBoxes)Actually, no. We can add this in the next patch, but for now, I'd recommend
creating a simple utility method to do the iteration on an arbitrary model
and build the list for you.
Todd -
Retrieving ALL values from a single restricted user property
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");Well, the code you've got will retrieve the single value of the property
for the current user. You're getting the default value because the
current user doesn't have Locations property set, so the ProfileWrapper
returns the default value from the property set.
I assume you want to get the list of available values that you entered
into the .usr file in Workshop. If so, I've attached a
SetColorController.jpf, index.jsp, and GeneralInfo.usr (put in
META-INF/data/userprofiles) I wrote for an example that does just this.
It uses the PropertySetManagerControl to retrieve the restricted values
for a property, and the jsp uses data-binding to create a list from that
pageflow method.
For a just-jsps solution, you can also use the
<ps:getRestrictedPropertyValues/> tag. I've attached a setcolor-tags.jsp
that does the same thing.
Greg
Dirk wrote:
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");
[att1.html]
package users.setcolor;
import com.bea.p13n.controls.exceptions.P13nControlException;
import com.bea.p13n.property.PropertyDefinition;
import com.bea.p13n.property.PropertySet;
import com.bea.p13n.usermgmt.profile.ProfileWrapper;
import com.bea.wlw.netui.pageflow.FormData;
import com.bea.wlw.netui.pageflow.Forward;
import com.bea.wlw.netui.pageflow.PageFlowController;
import java.util.Collection;
import java.util.Iterator;
* @jpf:controller
* @jpf:view-properties view-properties::
* <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
* <view-properties>
* <pageflow-object id="pageflow:/users/setcolor/SetColorController.jpf"/>
* <pageflow-object id="action:begin.do">
* <property value="80" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="action:setColor.do#users.setcolor.SetColorController.ColorFormBean">
* <property value="240" name="x"/>
* <property value="220" name="y"/>
* </pageflow-object>
* <pageflow-object id="action-call:@page:index.jsp@#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="240,240,240,240" name="elbowsX"/>
* <property value="144,160,160,176" name="elbowsY"/>
* <property value="South_1" name="fromPort"/>
* <property value="North_1" name="toPort"/>
* </pageflow-object>
* <pageflow-object id="page:index.jsp">
* <property value="240" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
* <property value="116,160,160,204" name="elbowsX"/>
* <property value="92,92,92,92" name="elbowsY"/>
* <property value="East_1" name="fromPort"/>
* <property value="West_1" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#begin.do#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="204,160,160,116" name="elbowsX"/>
* <property value="201,201,103,103" name="elbowsY"/>
* <property value="West_0" name="fromPort"/>
* <property value="East_2" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.ejb.property.PropertySetManager#propSetMgr">
* <property value="31" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.profile.UserProfileControl#profileControl">
* <property value="37" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="formbeanprop:users.setcolor.SetColorController.ColorFormBean#color#java.lang.String"/>
* <pageflow-object id="formbean:users.setcolor.SetColorController.ColorFormBean"/>
* </view-properties>
public class SetColorController extends PageFlowController
* @common:control
private com.bea.p13n.controls.ejb.property.PropertySetManager propSetMgr;
* @common:control
private com.bea.p13n.controls.profile.UserProfileControl profileControl;
/** Cached possible colors from the User Profile Property Set definition.
private String[] possibleColors = null;
/** Get the possible colors, based upon the User Profile Property Set.
public String[] getPossibleColors()
if (possibleColors != null)
return possibleColors;
try
PropertySet ps = propSetMgr.getPropertySet("USER", "GeneralInfo");
PropertyDefinition pd = ps.getPropertyDefinition("FavoriteColor");
Collection l = pd.getRestrictedValues();
String[] s = new String[l.size()];
Iterator it = l.iterator();
for (int i = 0; it.hasNext(); i++)
s[i] = it.next().toString();
possibleColors = s;
catch (P13nControlException ex)
ex.printStackTrace();
possibleColors = new String[0];
return possibleColors;
/** Get the user's favorite color from their profile.
public String getUsersColor()
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
return profileControl.getProperty(profile, "GeneralInfo", "FavoriteColor").toString();
catch (P13nControlException ex)
ex.printStackTrace();
return null;
// Uncomment this declaration to access Global.app.
// protected global.Global globalApp;
// For an example of page flow exception handling see the example "catch" and "exception-handler"
// annotations in {project}/WEB-INF/src/global/Global.app
* This method represents the point of entry into the pageflow
* @jpf:action
* @jpf:forward name="success" path="index.jsp"
protected Forward begin()
return new Forward("success");
* @jpf:action
* @jpf:forward name="success" path="begin.do"
protected Forward setColor(ColorFormBean form)
// set the color in the user's profile
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
profileControl.setProperty(profile, "GeneralInfo", "FavoriteColor", form.getColor());
catch (P13nControlException ex)
ex.printStackTrace();
return new Forward("success");
* FormData get and set methods may be overwritten by the Form Bean editor.
public static class ColorFormBean extends FormData
private String color;
public void setColor(String color)
this.color = color;
public String getColor()
return this.color;
[GeneralInfo.usr]
[att1.html] -
Passing null/empty values from a actionscript VO to a Coldfusion ORM object
This is the situation.
If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
For instance, if you have the following actionscript VO:
package vo
[RemoteClass(alias="com.companyname.Person")]
[Bindable]
public class Person
public var person_id:Number;
public var last_name:String;
public var first_name:String;
public var email:String;
public var created_date:date;
public function Person() {}
And you have the corresponding Coldfusion component:
<cfcomponent displayname="person" output="false"
alias="com.companyname.Person"
schema="dbo" persistent="true"
table="PERSON">
<cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
<cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
<cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
<cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
<cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
</cfcomponent>
Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created. This is bad, bad, bad. Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails. But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not. If you pass an empty string ("") you still have the same problem. I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
There seems to be two ways around it. One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine. I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
Have other people encountered this problem? How have you gotten around it? Thanks.I realize that I didn't clarify that I am using ColdFusion
for getting the data. This class was generated by the Create CFC
wizard in Flex Builder.
package com.generated
[Managed]
[RemoteClass(alias="components.generated.clients.Clients")]
public class Clients
public var clientid:Number = 0;
public var clientfirstname:String = "";
public var clientlastname:String = "";
public var clientaddress1:String = "";
public var clientaddress2:String = "";
public var clientcity:String = "";
public var clientstate:String = "";
public var clientzip:String = "";
public var clientphone:String = "";
public var clientemail:String = "";
public function Clients()
} -
Passing null/empty values from Flex to a Coldfusion ORM object
This is the situation.
If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
For instance, if you have the following actionscript VO:
package vo
[RemoteClass(alias="com.companyname.Person")]
[Bindable]
public class Person
public var person_id:Number;
public var last_name:String;
public var first_name:String;
public var email:String;
public var created_date:date;
public function Person() {}
And you have the corresponding Coldfusion component:
<cfcomponent displayname="person" output="false"
alias="com.companyname.Person"
schema="dbo" persistent="true"
table="PERSON">
<cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
<cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
<cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
<cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
<cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
</cfcomponent>
Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created. This is bad, bad, bad. Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails. But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not. If you pass an empty string ("") you still have the same problem. I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
There seems to be two ways around it. One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine. I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
Have other people encountered this problem? How have you gotten around it? Thanks.Looks like a known workaround to this issue is to wrap the Flex object in an array.
The ColdFusion CFC will accept that as an array, with the first an only element being a struct, which is the object you built in Flex.
Maybe you are looking for
-
Layout changed when I added spacing around images.
@charset "utf-8"; body { font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif; background: #363; margin: 0; padding: 0; color: #000; /* ~~ Element/tag selectors ~~ */ ul, ol, dl { /* Due to variations between browsers, it's best practices to zero pad
-
How do I rename many photos all at one time with one click?
I have got many photos of a sery and want to rename it all with one click only (instead of clicking through it all in single actions and wasting time). How can I rename many pictures/photos all together with one click only? - 1) I have OS X Yosemite
-
PDF documents appear jumbled in Preview
Hi, When I view PDF files created on a PC, in Preview the text is replaced by jibberish and square boxs. I have been told that the font is Arial. This font is installed on my Mac. Can I find out from Preview why it displays the PDF incorrectly or wha
-
Cant install Elements - or full version of photoshop
I have Photoshop elements installed on an old PC. However most of the time I'm abroad and only have access to a laptop. Recently I took some photo's that I wanted to fix up with photoshop elements. I didn't have the disc on me so I downloaded the tri
-
i am trying to solve an organizational problem where i have pdfs of published pages or work that are either one or two pages. this pdf format is very convenient for posting to the web in something like Scribd so that others can see it but it is very