function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Concenter  ServicesConcenter Services 

Packaging Issue with Formula Fields & Object ID References

We have an existing application that we've been installing for quite some time.  In it, there are formula fields that reference S-Controls and Images.  Previously when we deployed these applications, the S-Control & Image object ID's would dynamically get deployed with the respective object ID for the application it was being installed on.  As of 2 weeks ago, this process changed and now when the package installs, it retains the object ids of the developer account we installed it from, and therefore the application does not work.
 
Here is an example of a formula field in this scenario:
 
IF(ISPICKVAL(Completed__c,"YES"), IMAGE("/servlet/servlet.FileDownload?file=01570000000KSli","Complete"), IF(ISPICKVAL(Completed__c,"NA"), IMAGE("/servlet/servlet.FileDownload?file=01570000000KSli", "N/A"), HYPERLINK("/servlet/servlet.Integration?lid=01N700000000n0f&eid=" & Id & "&cid=" & Checklist__c & "&sid=" & $Api.Session_ID & "&retURL=%2F" & Checklist__c & "&Completed=YES&CompletedBy=" & $User.Id, IMAGE("/servlet/servlet.FileDownload?file=01570000000KSlm","Cls"), "_self")))
 
The red bolded IDs are the object ids for the images.  The blue bolded ID is the ID of the S-Control.    Again, when installing this package in the past, these IDs would automatically be changed to the correct IDs for the objects in the application it was being installed on.
 
We have an existing application that we've been installing for quite some time.  In it, there are formula fields that reference S-Controls and Images.  Previously when we deployed these applications, the S-Control & Image object ID's would dynamically get deployed with the respective object ID for the application it was being installed on.  As of 2 weeks ago, this process changed and now when the package installs, it retains the object ids of the developer account we installed it from.
 
Here is an example of a formula field in this scenario:
 
IF(ISPICKVAL(Completed__c,"YES"), IMAGE("/servlet/servlet.FileDownload?file=01570000000KSli","Complete"), IF(ISPICKVAL(Completed__c,"NA"), IMAGE("/servlet/servlet.FileDownload?file=01570000000KSli", "N/A"), HYPERLINK("/servlet/servlet.Integration?lid=01N700000000n0f&eid=" & Id & "&cid=" & Checklist__c & "&sid=" & $Api.Session_ID & "&retURL=%2F" & Checklist__c & "&Completed=YES&CompletedBy=" & $User.Id, IMAGE("/servlet/servlet.FileDownload?file=01570000000KSlm","Cls"), "_self")))
 
The red bolded IDs are the object ids for the images.  The blue bolded ID is the ID of the S-Control.    Again, when installing this package in the past, these IDs would automatically be changed to the correct IDs for the objects in the application it was being installed on.
 
Has anyone incurred any changes in the behavior of packaging in the last month or so?  Any help would be much appreciated.  Thanks, Cecilia
ForcecodeForcecode

This is still not working, has anyone heard when this will be fixed ?

It is critical to our (and I think many other) managed package.

Thanks.

ps7dps7d
I have exactly the same issue.  I am using HYPERLINK in a text formula on a custom field.  That HYPERLINK references our web tab by URL and an image.  The hyperlink is almost identical to the one mention on this discussion.  I had wondered if this hardcoded URL approach would work for apps on the AppExchange.  Based on this thread, it appers that it used to work up until a few weeks ago.  Has anyone heard any status on this.

If this is not fixed, I think the only resolution is to change our integration to not use custom fields so that I can run some javascript to find the URL dynamically or use the URLFOR function.  I can't do either one of those things in a custom Field (based on my current undertstanding and attempts).
A_SmithA_Smith
Hi MSP,

I would suggest turning your documents into static resources and your scontrols into visualforce pages. Then you could use a formula like this since you can do a by name reference:

IF(ISPICKVAL(Completed__c,"YES"), IMAGE("/resource/myNS__myStaticResourceName1","Complete"), IF(ISPICKVAL(Completed__c,"NA"), IMAGE("/resource/myNS__myStaticResourceName2", "N/A"), HYPERLINK("/apex/myNS__myNewVFPageName?id=" & Id & "&sid=" & $Api.Session_ID & "&retURL=%2F" & Checklist__c & "&Completed=YES&CompletedBy=" & $User.Id, IMAGE("/resource/myNS__myStaticResourceName3","Cls"), "_self")))

I haven't tested all this, but I believe it should work. The "myNS" needs to be replaced with the namespace of your package if you are using a managed package.

Thanks,
Andrew
TheThe

Does anyone know if a resolution was ever found for this?  We have a managed package in which we planned to include a formula field to display one of four images based on certain criteria, but this won't be possible due to the hard-coded document URLs in the formula.  We tried the static resource method suggested earlier in the thread and it was not effective (only the optional text description would display, not the image itself).  

 

Since we are distributing our app via Trialforce we plan to include the documents and the formula field in our DOT instead.  If this method is effective (i.e. if the trial user can see the images in the provisioned trial org) then we have a workaround, but it's not ideal and certainly won't be effective for AppExchange distribution. 

A_SmithA_Smith

The static resource should have worked.  Can you post more details around what the issue was with this solution?  Maybe some sample code?  

TheThe

Yes, I loaded an image "Happy Face" as a static resource and then tried to use it with the following formula:

 

IF( AmplifyHealth__Last_Survey_Response__c = 10, IMAGE("/resource/AmplifyHealth__Happy_Face", "Happy", 60, 60),
IMAGE("servlet/servlet.ImageServer?id=01550000000XKGf&oid=00D50000000IYrJ&lastMod=1286805614000", "Unhappy", 60, 60))

 

Instead of displaying the image when the last survey response = 10, the field showed the text "Happy".  The "else" result references a document and that one does display the desired image properly.

A_SmithA_Smith

Did you upload the image directly or did you zip the image then upload it to the static resource.  What are you are doing should work.  

TheThe

I uploaded the image directly.  Is it advisable to zip it instead?

A_SmithA_Smith

Should be a file - not zip.

 

Try creating a VF page with this code inside it:

 

{!$Resource.AmplifyHealth__Happy_Face}

 

Then view the page and see what the URL is.  When you use the URL, you need to remove the numbers that appear in it.

 

So /resource/9230102301230123/AmplifyHealth__Happy_Face should be /resource/AmplifyHealth__Happy_Face

TheThe

Excellent, it worked!  Thanks for your time.