Archive for the ‘Development Issue’ Category

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.

Alternative to Application.application

August 27, 2010

If you are using Application.application in your code you aren’t probably doing the best thing to your code for reasons more than one. Like Flex 4 no longer supports it, While using sub-applications or modules it will end up in trouble and MOST IMPORTANTLY it will tightly couple your application to the component

Instead, for most cases you (if you are dispatching an even using Application.application) you can set the events bubble property to true and listen to the same events at the application level. This will work for itemRenderers in DataGrid’s too.

Other option is to use a GenericEventDispatcher that extends from EventDispatcher and can be a singleton. So instead of dispatching an event using Application.application.dispatchEvent you can instead use GenericEventDispatcher.instance.dispatchEvent. This will work across all components and also between modules and sub-applications.

Adobe Flash Platform Summit

August 27, 2010

Had a great time speaking this year at the AFPS. It was really well organized and kudos to the Adobe team for pulling this one off so well.

Here is my presentation: Flex 3 t o Flex 4.

Will also be putting up a small document on this soon.

ReferenceError: Error #1069 – Property maxFrequency not found on mx.data.DataManagementConsumer LCDS DataManagement service

February 13, 2010

If you are facing this issue while using RTMP channels in LCDS:

ReferenceError: Error #1069: Property maxFrequency not found on mx.data.DataManagementConsumer and there is no default value.
at mx.data::ConcreteDataService/get maxFrequency()[C:\depot\DataServices\branches\dune_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:705

There are 2 problems here 1 with the Flex SDK and  other with the LCDS/BlazeDS version:

1. Make sure you have the correct version of Flex SDK (3.4 or higher) This issue is because of the fds.swc (make it compatible with your lcds version)

2. Check you data-management-config for throttle policies in network configuration in destination tag -> Set them to NONE or IGNORE (earlier versions supported ERROR and REPLACE) -> This if your LCDS is 3.0 or higher

<network>
<session-timeout>20</session-timeout>
<paging enabled=”false” pageSize=”10″ />
<throttle-inbound policy=”NONE” />
<throttle-outbound policy=”IGNORE” />
</network>
Restart LCDS and recompile your application to include newer version of your data-management-config
This should solve the problem

BlazeDS + IE+ HTTPS issue

July 14, 2009

Problem:  While using blazeDS content is not transferred over HTTPS this may be because of a firewall or a reverse proxy like web-seal in deployment.

So if you have blocked the port 80 on server you will notice that application gets loaded but calls are throwing a ChannelFaultEvent.

Reason:

The request coming in from client over https hits the firewall which should be the endpoint URL and because of this the server side(firewall) should fire the request on the non-secure/HTTP port of BlazeDS server.

Solution:

The configuration of the channel should look something like

<channel-definition id=”secure-amf” class=”mx.messaging.channels.SecureAMFChannel“>
   <endpoint url=” {contextRoot}/messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint“/>
   <properties>
                 <add-no-cache-headers>false</add-no-cache-headers>
</ properties>
</ channel-definition>

 Notice the client uses a secure channel and the server uses an insecure endpoint

Cheers,

Y


%d bloggers like this: