Friday, May 22, 2015

SalesForce support different package type so you can distribute your app to your customers. Here is summary of what we found:

Scenario

Packaging

Unamanged with/without namespace

Managed Beta

Managed Released

Description

Unmanaged packages are typically used to distribute open-source projects or application templates to provide developers with the basic building blocks for an application. Once the components are installed from an unmanaged package, the components can be edited in the organization they are installed in. More Information

Use to test and validate this package internally and with selected customers before release.

Note: this type of package can only be installed in Developer Edition, sandbox organizations, or testing organizations for registered partners

For a given managed package, for each version we can decide it to have it beta or released. Typically there would be multiple beta versions in between each release.

Here via Jquery iframe1 and iframe3 content shows up as "undefined". It works fine for iFrame2.

In SalesForce, if you include visual force page inside the standard page, it is included inside the iFrame and Salesforce includes visual force page with different domain iFrame, as below. Hence in parent container JQuery would not be able to access content of child visual force page iframe.

Thursday, May 14, 2015

In visual force page, it is quite easy to implement light box using any of the jquery plugin or even with just use of css. However when we have standard page and want to open light box upon button/link click, it wasn't straightforward:

This option doesn't work well, as when we include the visualforce page in standard page, it includes that page inside iframe. Hence if you open the light box from visualforce page, it will stay inside that iFrame.

Option 2 : Modal Dialog

When we create custom button to open the visual force page, it always opens in new page, to open as modal dialg, we can use below java script:

Javascript
In below script, it opens up the visual force page using modal dialog. It updates the parent page's onFocus and onClick event so it is disabled when the child window is open.

In this option we will use javascript to insert lighbox on the fly. For this option we had to get JQuery loaded which helps with DOM manipulation (and also we had to get some content from server so had to make rest calls).

in JavaScript block, load JQuery, JQueryUI and JQueryCSS. Once JQuery is loaded, the lightbox function is called (as mentioned in line 27).

Extra note here (not needed for this example), we are displaying iFrame inside lightbox and I had to get iFrame URL from server, hence I had to make Rest call using JQuery as below (also explained in detail here)

In Visual Force, it is very straightforward to use server side logic (Apex Classes) using Controller. However, when working on standard page - e.g. custom button java script, we didn't have access to the controller. E.g. below we have access to object and JavaScript block. SalesForce executes this java script using JavaScript's eval function.

If we need data from server side, it is a lot easier to get that using SalesForce Rest API. We also don't need to worry about security as we can get OAUTH Bearer token using {!$Api.Session_ID}').