Archive for the ‘Training-Beginners’ Category

INVALID_FIELD: No such column ‘type’ error in flex salesforce communication

October 29, 2010

While trying to pass a custom object in salesforce from Flex. If you encounter the below error. Especially if you are passing a wrapper class to the webservice method.

“INVALID_FIELD: No such column ‘type’ on entity . If you are attempting to use a custom field, be sure to append the ‘__c’ after the custom field name. Please reference your WSDL or the describe call for the appropriate names.”

This occurs because the flex salesforce toolkit forces a property type while creating request parameters to be serialized with salesforce.

There are 2 solutions to this: First the not so attractive one is to convert everything to wrapper classes and send all data as SObjects. This will add overhead on salesforce  side to manage the conversion of object.

Second, go to Salesforce flex toolkit and add a condition to the SObject class on line 101:

if(this["type"]){
this.writeValue(sobjectNs, writer, "type", this["type"]);
}

This should solve the issues of not being able to send the data to salesforce.

Flex Framework for SalesForce Apps- Part 4 Application

October 28, 2010

Now that we have seen the concepts, understood how flex and salesforce can talk to each other. Time to see an application build with this approach. You can download the application from here (Right click and select download linked file as..)

And the library Project from here.

For every call what needs to be done is very simple: Create a controller, add mapping and dispatch an event with bubble set to true.

Import the FXP and the FXPL into your flash builder and put the correct configuration in for salesforce  and your code should be working.

The responder handles the result or fault. RC4SF can be used with any existing framework like Mate or SWIZ. Personally I find code based configuration better than writing XML based configuration in my code and hence the approach. We intend to put all those things online as soon as we are able to breathe a bit out of our consulting assignments 😉 We ‘ll keep exploring and posting it here.

As I sign off  this series a small note. This is not a new framework. We have used this for a while not and almost all frameworks use the same principles. We have combined what we knew was the best and here one that suits us the best. Feel Free to Modify the source code or use any part that you think will be useful for your project.

Up next: Using Melrose: Putting AIR apps on the Intel AppStore and more 🙂

Flex Framework for SalesForce Apps- Part 3 Working

September 18, 2010

In the last part we have seen the framework specifics. In this part lets see how it all comes together. There are several classes that we need to create. Before we get there lets look at the way the salesforce toolkit works.

There are a few toolkit classes that we need to know:

Connection: This class is responsible for communication with SFDC. Connection allows querying as well as calling webservice methods. For metadata the Connection2 class has to be used. The key methods are login() and execute()

AsyncResoponder: When a request is sent to salesforce a responder is associated to it that is responsible for handling the result/fault for that call.

Parameter: All request parameters need to be sent as an Array of objects of type  Parameter class. A vector would have been ideal in this case however the toolkit comes from Flex 3 days.

Lets look at the framework components and the end to end flow.

The core idea is MVC based where we have a controller who is responsible for making decisions on service and handling the business logic.

The fundamental approach of accessing the service is the Command pattern. This is pretty much like cairngorm except the fact that we are using the com.salesforce.AsyncResponder class for handling responses. The reason is simple. The execute method in the Connection class expects and object of AsyncResponder. Hence we can simplify the code drastically.

The Command class can be seen as a helper to the main Controller class where it takes away a responsibility from the controller of sending a particular request and handling its response. It implements an ICommand interface which includes an “execute” method. This method is responsible of sending the service call and extends from the AsyncResponder class due to which the result and fault methods need to be overridden.

All these requests are generated from a view (or other commands) where the notification travels in form of an event to the controller and based on the event the controller invokes the correct Command. This does not require the event to be of a specific type rather it can be any event with the bubbles property set to true.

RC4SF - view controller

RC4SF (View Controller Flow)

The Connector class is the service layer which in our class is a class with 2 static members. First the connection object from salesforce which can be used for login or describing an object. And second the invokeSFDC method which will call the correct webservice method.

The steps are simple:

1. Create and instance of the Controller and pass the reference of the main application

2. Dispatch an event from application with bubbles set to true

3. Create a command to handle request from the events

4. In the controller add association of the event being dispatched with the Command

5. Call the SFConnector classes invokeSFDC with correct parameters

6. Handle result/fault in the responder which called the request

Here is the code for this bit. At the end of all parts will be uploading the framework and a sample/template application

/**
Connector class
*/
package com.tekno.rc.service

{

import com.salesforce.AsyncResponder;

import com.salesforce.Connection;

public class SFConnector

{

public function SFConnector(){

}

public static var connector:Connection = new Connection	();

private static var _webServiceClass:String;

private static var _namespace:String;

public static function set webServiceClass(value:String):void{
_webServiceClass = value;
}

public static function get webServiceClass():String{
return _webServiceClass
}

public static function set namespace(value:String):void{
_namespace = value;
}

public static function get namespace():String{
return _namespace;
}

public static function invokeSFDC(method:String,args:Array,responder:AsyncResponder,webServiceClass:String="",namespace:String=""):void{

var _ws:String = _webServiceClass;

if(webServiceClass.length > 0){
_ws = webServiceClass;
}

var _ns:String = _namespace;

if(namespace.length > 0){
_ns = namespace;
}
connector.execute(_ws,method,args,responder,_ns);
}
}
}

The Control class:

package com.tekno.rc.control

{

import com.tekno.rc.control.commands.ICommand;

import flash.display.DisplayObject;

import mx.rpc.AsyncResponder;

public class Controller
{

private var app:DisplayObject;

public function Controller(app:DisplayObject){
this.app = app;
}

public function mapCommandToEvent(eventName:String,responder:ICommand):void{
app.addEventListener(eventName,responder.execute);
}

}
}

In the next part we see an application working with the framework. And the entire source code

Flex Framework for SalesForce Apps- Part 2 The Framework

September 9, 2010

In the last part we ‘ve looked at  basic terminology its time to take a deep dive into the architecture now. Just before we go on there is one small disclaimer here:  This is not a tutorial on how to integrate flex with salesforce, you can find a bunch of them every where, this one is to understand ways in which you can architect an application to leverage the existing arrangement.

Now that we are even, lets look at the framework, it is based on existing Rapid Connect (thank you, Abdul Qabiz for the name) framework that we use extensively and  uses 2 principles from Bruce Lee’s JKD.

  1. Use Lesser Resources (Keeping it simple)
  2. Tailor make it to your requirement

Like JKD which is a fighting philosophy which combines various methodologies (best of all worlds) we are going on a similar approach in taking best of existing framework/micro architectures and simplifying it greatly. “If its not simple, its not right.”

The core of the Framework is a simplified version of any MVC framework that you can think of, uses existing classes from the flextoolkit provided by SFDC to manage commands and responders (ala Cairngorm) and reaches them using Flex’s event propagation capability (any DI architecture like mate, swiz…) and coupling this with the requirement to push data from a non UI class to use a GenericEventDispatcher which I described in an earlier post. You may want to use this or may not want to user this.

It uses simple MVC approach:

MVC in Flex

MVC in flex regardless of the micro architecture you use leverages 2 major Flex principles.

1. Event Mechanism (invoke controller)

2. Concept of Binding (Model updates views)

However, this is a 10,000 feet view as we go deeper there are specifics and intricacies that are involved. Here  we take a closer look at the architecture we are using and then define each of its entities and see how it all comes together.

Rapid Connect for SalesForce RC4SF (Yes that’s what we are going to call it, at least for now) looks like this:

Rapid Connect 4 SalesForce

Rapid Connect 4 SalesForce

The Entities here are:

1. The View: is any UI component, typically an MXML one which can dispatch an event (with bubbles set to true)

2. The Controller: is an entity that listens to the events coming from the view and handles them

3. The AsyncResponder: is a class which is something like a command class in Cairngorm earlier versions however it uses the salesforce AsyncResonder instead of using an interface and overrides the result and fault method (Here you can decide if you want to call the service from here or you want controller to handle that part. More about this in part 3)

4. The Connector: is the class that plays a role of a service class. This class contains the SFDC connector obejects and calls methods to login, invoke a webservice method and get metadata

5. The GenericEventDispatcher: is a singleton EventDispatcher which is responsible for inter-application communication in a more effective manner (in the past people have been using Application.application for this purpose)

6. The Model: is your data store. This can be a singleton (if you are a fan of Cairngorms ModelLocator approach) or can be VO classes. You can either use binding to update the objects or use the generic event disaptch mechanism if you have to invoke something on the UI.

This broadly covers everything that we need to cover for the framework.

Up next in part 3: The working of the Framework and some code

Flex Framework for SalesForce Apps- Part 1 Warm Up

September 7, 2010

We have been working on a few sales force – flex apps for our customers since last September. Initially all the entities involved can really overwhelm you. It is extremely critical to get the application architecture right because the data model is mostly dynamic and also the toolkit has its own overhead.  We are trying to share the approach that we use to build SFDC – Flex apps.

Let warm up. Starting from salesforce terminology:

1. ToolKit: Salesforce.com provides a toolkit (actionscript library) using which you can communicate with the salesforce.com platform. Using this toolkit gives a head start to your SFDC- Flex Apps

2. Apex Webservices: SFDC has a language called Apex using which you can create webservices to access you application. It is predominantly based on Java, however, there are a few restrictions

3. Visual Force: VisualForce or VF is a UI technology for salesforce, primarily driven on Ajax it allows integration of Flash components (read SWF) into it. You can write JavaScript into it and hence has a big advantage. There are other UI things like S-Controls which we need not look into now.

4. Static Resource: In simple terms a static resource is any media,document,file which needs to be uploaded to SFDC for your project. So the SWF will be uploaded as a static resource. (Rather the entire output folder from flex)

5. <Apex:Flash>: This tag is used inside the VF page to help you embed swf. You can pass FLASHVARS set height, width.

6. Briefcase (AIR apps): Briefcase is a SalesForce concept using which you can create off-line applications. Add objects to the briefcase (though some objects like case can not be added to it) and then you can sync data from your off-line application.

7. Org: Your part of salesforce.com which you can customize and use as your requirement. Every customer has his own org and his own installation (package) of the application

8. sObject: sObject refers to any object that can be stored in the Force.com platform database. An sObject variable represents a row of data and can only be declared in Apex using the Web services APIname (the name with which the object is identified) of the object. This is of high importance as most webservice communication will involve sObjects

You can build you project either based on web-services or write the business directly onto the flex calsses, we do not use the later as we want flex to be unaware of the core business and keep it as generic as possible. However the framework is equally applicable to any type of project. ideally on the salesforce front if you are making webservices there should be good care taken to ensure only one webservice class is exposed to flex and the rest of the things can be in remaining wrappers.This keeps the architecture much more robust and generic.

Some warm up on the flex side (assuming you know flex):

1. Depending on the type of project you want to build (Flex or AIR) include the SWC of the toolkit which can be downloaded from here

2. It is good to have the code linked for the SWC since you will need to go to and fro

3. Setting up the architecture:

Apart from flex UI, the architecture contains 2 key elements: 1. The Controller and the Async Tokens

In the next part we exclusively look at the concept of the architecture, various entities and the working.

Learn Flex from Champions for Free !!

September 6, 2010

Adobe Flex is picking pace and is reaching a more organic level viz. the student community in India, and rightly so. If the next generation of engineers come equipped with knowledge for technologies like Flex, ColdFusion, Silverlight, Scala etc it will give Indian IT a new high.

There are lot of initiatives that are going on currently to spread Flex around. Like Adobe’s Flex@Campus which gives educational organization across India to leverage a free 1 day training on Adobe Flex. The flex community in India has extended its support to it. Because it is a hands on program, it gives you a head start into the technology allowing you to create a base on which you can build up.

Then there is RIA Connect. It is a Tekno Point initiative that is not restricted to Flex alone. It could me on any Adobe Product like Photoshop, Illustrator, Flash Professional, Flex, ColdFusion. It is a 1 day program for corporates, educational institutes or any other organization allowing them to understand the underlying abilities of the Technology and a follow up hands on session to get them started. The contents of this one day workshop are modified keeping the audience in mind. For Designers/ Devs there is more of  hands on and for business heads, architects there is more breadth in which the workshop topics are covered.

Don’t wait to get started. Go to the links and fill the forms to take your first step, as common sense says “To reach anywhere, you have to start from the beginning and go through the middle”

Flash Builder 4 ( Flex 4) : Overview part 2

June 3, 2009

So as promised , here I am with part 2 of overview on what’s new with Flash Builder 4. The part 1 was about IDE related changes in FB4.

Part 2:  Components and Syntax

In part 1 we have been talking about the IDE features. Staying in the design view, the components explorer now you can notice a few folders.
Adobe has released a new suite of (sprite) flex components with the sdk 4.0 which are called as spark components. So now we have 2 types of components
1.    Halo Components – The existing UIComponents (sdk 3.4)
2.    Spark Components – The new set of components
Let look at each folder
Controls
While most of the controls remain the same in both versions a there a few changes
Added:
•    Spinner (close to Numeric Stepper)
•    DropDown (redefined ComboBox)
•    VideoPlayer (newly added in place of VideoDisplay component)
•    RichEditableText (newly added). This is where you can see the amazing text control features like right-to-left, baseline-control and justification of text

The RichTextEditor has been removed from the list.

Data Controls:
All lists have now been grouped under data controls. Apart from the regular ones, there is one addition to this – the paged List control. The Spark list control offers higher-level functionality like paged-data  (by a ‘layering’ mechanism).

Containers:
No VBox,  HBox or Canvas, they have now been replaced by Group containers. So you have HGroup, VGroup well mostly the styling behavior has changed. You can review the example that follows the article to see how they behave.
Then there are these which have been added:
•    DataGroup
•    Scroller
•    SkinnableContainer
•    SkinnableDataContainer

Custom Components
Two new components
Flash component and Flash container: To allow you to directly access a component created in Flash Authoring tool.

New Flash Custom Components

New Flash Custom Components

NameSpaces
Moving onto syntax, the way new elements are created is a little different than Flex 3. Again most of these changes are on the styling side which I plan to explore a little later. We ll stick to the changes on code:
Namespaces have been changed. Now there are 2 basic namespaces that you would find yourself working with:
1.    xmlns:fx=”http://ns.adobe.com/mxml/2009&#8243; – Contains non UI objects like arrays, objects, metadata declarations. That means when you add a script block in flex 4 the tag would be <fx:Script>.
2.    xmlns:s=”library://ns.adobe.com/flex/spark” – Contains the spark component library.
3.    xmlns:mx=”library://ns.adobe.com/flex/halo” – Contains the Halo component library.

Coming up next : Flash Builder 4 : Overview Part 3 on Styling

Flash Builder 4 (Flex 4): overview part 1

June 2, 2009

Finally Flash Builder 4 (read Flex Builder 4) is out. I was trying to review on what has changed and whats new in the latest release. Flash Builder… I don’t know I think I like Flex Builder better 🙂

I will review new features in Flash Builder 4 with respect to IDE ,Syntax,Components,Styling,Performance and finally a Conclusion.

So lets get started with the IDE,

On the whole the IDE looks just about the same. But look a little closer and you will notice a host of other things. The top then things that you might notice (If  you start building a project right away) are…

1 The Package Explorer (Flex Navigator in FB 3)
-The code management has changed a little.
-The packages are now grouped, which is a very good thing (you will know why if you use cairngorm)
-Outline has been included with the class shows SDK (framework) packages
-Uses swfobject.js instead of AC_OETags.js

The new Package Explorer (earlier: navigator)
The new Package Explorer (earlier: navigator)

2 The Component Explorer

The  Components view in the design mode now has a different folder structure. Some new components have been added and you won’t find some old components like the numeric-stepper. I will be adding a detailed review on components in part 2.

Components have been recatogerized

3 Data Services Tab

By Far, the most exciting feature of FB4. This tab allows you to link data from a source without a single line of code. See it to believe it.

The Data Services TabThe Data Services Tab

4 The Network Monitor

Adobe has really worked on Developer productivity and I say this because of this super cool feature that allows you to see the communication your app makes with your data server. No more searching for analyzers and http sniffers online  🙂

The network monitorThe network monitor

5 ASDocs window
Another one for developer productivity. If you are working on Flex 3 I am sure you ll love this. No more opening new windows or googling up what some property means. The ASDocs  window allows you to see it there and then.

ASDocs Window

6 Auto Function Generator
Another one that generates a function definition without any typing 🙂

Auto generate functions for events

7 Theme chooser

Components are now divided into Spark and Halo(standard flex 3 components) compoents and with the theme chooser you can how you want to display them…

Theme Chooser

8 Appearence Window
Along with the Properties components (enhanced quiet a lot) there is another tab for Appearece. The styling for Flex 4 components has changed (especially for spark). The appearance window mainly caters to it.

Appearence window (For Spark components)

9  States in Code View
This release will amaze you if you are a flex developer. State management, it seems has been enhanced drastically and this options grey’s out everything that is not included in the selected state. WOW !

States selector for code view

10 Export as FXP – The new export format

The flex project archive (.zip) is now FXP.
This has been about the IDE Features and there is a lot more to explore, for the next part lets try our hands on some new flex compoents .

Export as FXP from File Menu

Coming up  : Review of Flash builder 4 Syntax,Components,Styling,Performance and finally a Conclusion.
Download Flash Builder 4 today

We have pledged 5 100% Scholarships to a NGO

July 9, 2008

Following is the information related to the scholarship we are providing via Education Times and United way, a NGO. Please get in touch with them to apply for scholarship of our ‘Web and Graphic Designing with Specialization in Flash ‘course.

Background
Education Times, the thinking, youth-centric supplement of the Times Group at the completion of its 13 years of service in the Education sector aspires to build a deeper connect with its young readers. With is motto of “The Future, Now” Education Times this year wishes to launch a project which would touch the lives of its readers and the student community at large in a more meaningful manner.

We plan to initiate a scholarship drive to reach out to the students, who possess the flair, capability and aptitude but lose out on account of lack of financial resources.The process of shortlisting the candidates would be undertaken by United Way.

About United Way
United Way of Mumbai was established in 2002 on the initiative of Mr. David Good Ex-US Consul General India and with the support of American International Group, Citibank India, Ernst & Young, India, Hunt Partners, Jasubhai Group, J M Morgan Stanley Securities, Mahindra & Mahindra, Morgan Stanley New York, Principal Asset Management and Sony Television.

Role of the NGO

  • Procuring a pool of applicants for the scholarships
  • Identification of the right candidate for the Screening the applicants profile in terms of Family background, income status, and other relevant information.
  • Administer aptitude tests (if required) incase a requirement of certain skills prior to awarding the scholarship

Contact Information

Seminar on Web 2.0: Design Guidelines

July 1, 2008

Web 2.0 is the most happening buzz among everyone in the community of internet enthusiasts. In our course for beginners , we have many students who have either not heard about it or have just heard about it but dont know what it means to them. The design team at Tekno point multimedia decided to share some insight with students. After discussing over what is the best way to present the idea , we boiled down to the idea of sharing design guidelines related to web 2.0 , rather then showing them all the web 2.0 websites and leaving them overwhelmed.

It was our first attempt and the response was terrific, all the students responded well to the idea and we had a full house for the session, in fact we had more registrations then what our lab could accommodate .

Design Guidelines The session was for 4 hours , I am sure even this was not enough but we had to limit it to 4 hours considering various logistical issues.

We took a detailed feedback from the students on the seminar as we wanted to know where we can improve. The feedback we received was amazing. We clearly saw that students wanted us to do this more regularly, some of them wanted more duration, a lot of them found it to be very systematic and everyone picked up at least 2 things that will help them to perform their work in a better way after the seminar. The average ratings of the seminar across participants was 4.6 on 5.

Seeing such a tremendous interest from the students , we have decided to conduct similar sessions with students on topics related to their course however out of the scope of the training curriculum at regular intervals. We are doing another round of seminar on 26th July 2008 on Web 2.0 :Design Guidelines for the benefit of students who missed out earlier , . and also there is a seminar on Color Theory coming up from one of the faculty members.

You can find more information about our courses on our website by clicking the link  ‘web and graphic designing with specialization in flash‘ .

For any feedback or comments please feel free to write to us on learn@teknopoint.info

Cheers,
Himanshu Mody


%d bloggers like this: