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
AdityaRAdityaR 

Problem with Namespace Prefix in managed Package

Hi,

 

We are currently facing an issue while creating a managed package.

 

One of our formula fields is used to display an image stored in static resources.

 

IMAGE("/resource/Logo",'Logo',50,150)

 

After creating the managed package, the image is not displayed and appears broken. This seems to be a problem with the namespace prefix not being appended to the image name in the above formula. Also, $Resource is not available to reference static resources in formula fields.

Is there a way to automate this ?

 

Thanks,

-Aditya

Ankit AroraAnkit Arora

I don't think there is anything related to namespace here. As far as formula fields are concerned, you can reference static resource like this :

 

IMAGE($Setup.StaticResource__c.YOUR_STATIC_RESOURCE_NAME, "Logo", 50,150)

 

Hope this will help.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

AdityaRAdityaR

Hi Ankit,

 

Can you please explain the syntax provided by you ?.

 

IMAGE($Setup.StaticResource__c.YOUR_STATIC_RESOURCE_NAME, "Logo", 50,150)

 

I can't seem to find a way to use $Setup in a formula field. Also is 'StaticResource__c' a way to access static resources ?..

 

I access images stored in static resources in the following way:

 

IMAGE("/resource/Logo",'Logo',50,150);

 

But once a managed package is created, the image does not show up and appears broken in the org where I install the package.

 

If I change formula to IMAGE("/resource/nsp__Logo",'Logo',50,150) where 'nsp' is the namespace prefix, and then upload the package, the image is seen properly in the org where the package is installed.

 

Please help me out with this

 

Thanks,

-Aditya

 

Ankit AroraAnkit Arora

See to check how you can add static resource in formula field :

 

Go to your object > Fields > New > Select Formula > Next > Return type text > Advanced Formula > There you can see option $Setup.StaticResource__c.

 

If not then check your organization, this option is coming in developer edition but not in enterprise edition.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

AdityaRAdityaR

Hi Ankit,

 

The only options that I am able to see are :

 

$Api, $Organisation, $Profile, $System, $User, $UserRole.

 

The org that I am using is a developer edition org.

 

Thanks,

Aditya

 

Juan SpagnoliJuan Spagnoli

Ok... thinking about what you are saying, i did this:

 

IMAGE('/resource/' + $Setup.Package_Resources__c.Prefix__c + $Setup.Package_Resources__c.Name__c + '/images/flags/' + Name +'.gif', Name)

 

Where "Package_Resources__c" is a Custom Setting, with 2 fields: "Prefix" and "Name". In prefix i'm saving the prefix of the package, and in name the static resource name.. so it works fine. :)

 

 

Thank you guys