You need to sign in to do that
Don't have an account?
t j 5
Solved the problem: How to automatically update app logo of managed package
Hi,
Please, help me for the test case.
Here the code how to automatically update app logo of the managed package but the issue in a test case can any one try to create a test case for the same code below:
global without sharing class PostInstallScript implements InstallHandler
{
global void onInstall(InstallContext context)
{
PostInstallScript.AppLogoUpdater('NewLogo.PNG');
}
@future (callout=true)
public static void AppLogoUpdater(Sting ImageName)
{
Http newHttp = new Http();
HttpRequest request = new HttpRequest();
string imageURL = 'http://yourRemoteSiteURL/'+ImageName;
imageURL = imageURL.replace(' ', '%20');
request.setEndpoint(imageURL);
request.setMethod('GET');
request.setHeader('Content-Type', 'image/png');
request.setCompressed(true);
request.setTimeout(50000);
HttpResponse result = null;
result = newHttp.send(request);
string responseValue = '';
responseValue = result.getBody();
blob image = result.getBodyAsBlob();
Document VarDocument = [SELECT Id, body FROM Document WHERE name='Your App Logo Document' limit 1];
VarDocument.body = image;
update VarDocument;
}
}
Thanks
Please, help me for the test case.
Here the code how to automatically update app logo of the managed package but the issue in a test case can any one try to create a test case for the same code below:
global without sharing class PostInstallScript implements InstallHandler
{
global void onInstall(InstallContext context)
{
PostInstallScript.AppLogoUpdater('NewLogo.PNG');
}
@future (callout=true)
public static void AppLogoUpdater(Sting ImageName)
{
Http newHttp = new Http();
HttpRequest request = new HttpRequest();
string imageURL = 'http://yourRemoteSiteURL/'+ImageName;
imageURL = imageURL.replace(' ', '%20');
request.setEndpoint(imageURL);
request.setMethod('GET');
request.setHeader('Content-Type', 'image/png');
request.setCompressed(true);
request.setTimeout(50000);
HttpResponse result = null;
result = newHttp.send(request);
string responseValue = '';
responseValue = result.getBody();
blob image = result.getBodyAsBlob();
Document VarDocument = [SELECT Id, body FROM Document WHERE name='Your App Logo Document' limit 1];
VarDocument.body = image;
update VarDocument;
}
}
Thanks