• Josip Juric87
  • NEWBIE
  • 45 Points
  • Member since 2015
  • Josip Juric

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 15
    Replies
After installing VS Code and adding the Salesforce extensions, I get the error: "Java 8 is required to run. Download and install it from https://java.com/en/download/.", although I have Java 9 running. What can I do to fix that?
I have a Lightning Component which is added to the view page for the Opportunity object. The component contains an event handler for the "force:refreshView" event. When changing data of the Opportunity, the component should refetch its data and rerender.
Now, when changing the record type of the Opportunity, sometimes (unpredictably) the following error is thrown:
Uncaught unrender threw an error in 'markup://force:relatedListSingleContainer' [Cannot read property 'push' of undefined]
throws at https://trotec--uat.lightning.force.com/auraFW/javascript/JlFNX6n1lvQX93lGHpJl_A/aura_prod.js:8:15
Object.a.addToQueue()@https://trotec--uat.lightning.force.com/libraries/force:relatedListsDataManagerLibrary.js:11:405
eval()@https://trotec--uat.lightning.force.com/libraries/force:relatedListsDataManagerLibrary.js:5:275
Array.forEach()@(native)
Object.a.unregisterRelatedList()@https://trotec--uat.lightning.force.com/libraries/force:relatedListsDataManagerLibrary.js:5:228
Object.onDestroy()@https://trotec--uat.lightning.force.com/components/force/relatedListSingleContainer.js:13:375
unrender()@https://trotec--uat.lightning.force.com/components/force/relatedListSingleContainer.js:16:135

What can be the cause for that? Any suggestions?
I have created a custom Lightning Component, implementing "force:LightningQuickAction,force:hasRecordId", because it should be used on the Case object as a custom action. Now, on Cases it seems that the custom actions are not showing (as for the other objects) in the Hightlighs Panel, alongside the standard buttons (e.g. Edit), but instead they show up in the Chatter Publisher.
So, my 1st question would be - can the action be somehow moved up to the Highlights Panel?

If not, then I have the following problem with the custom action being in the Chatter Publisher. When clicking on the button for the custom action inside the Chatter Publisher, the Lightning Component is shown. BUT, it also shows the default Lightning Experience "placeholder", which is usually shown only while a component is loading. In this case the placeholder stays forever (also after the component was loaded):

User-added image

Has anyone an idea what the problem is? Maybe the components shown inside the Chatter Publisher should implement a different interface, i.e. not "force:LightningQuickAction" ?
I have the following situation: 
There is a lightning component which shows a canvas html-element, and is used to render a chart. For some reason (which I will not explain here), when I want to redraw the chart, I need to:
1) destroy the existing canvas element,
and
2) create a new canvas element instead.
How can I do this with Lightning Components? Do I need to use the LC Renderer ?
When using @auraEnabled Apex methods to return a custom class which extends some other class, the properties from the base class marked with @auraEnabled are not returned to the javascript controller of the lightning component. The issue has been already documented on stackexchange. Are there any news on this?
Hi there,

I need a custom Connected App authorization mechanism (depending on certain data in the org, I want to accept or reject the authorization for a user). Now, I understand this could maybe be achieved by implementing the Auth.ConnectedAppPlugin and setting it as the Custom Connected App Handler for my Connected App. Unfortunately, there are no resources explaining details about the implementation of this interface, and it's not really working for me. I have 2 question:

Question 1)
I have created a test version of the handler-class, where the authorize() simply always returns false:
public override Boolean authorize(Id userId, Id connectedAppId, Boolean isAdminApproved) {
	return false;
}

public override Boolean authorize(Id userId, Id connectedAppId, Boolean isAdminApproved, Auth.InvocationContext context) {
	return false;        
}
When the user tries to authorize for the first time, this fails.
In the next step I have changed the implementation to always return true. After that, the user was able to authorize.
In the final step I have changed the implementation back to return false. After that, the user was still able to authorize!
Why is that? Can this be avoided somehow?

Question 2)
How can I prevent authorization in the refresh process? My guess is, when the refresh token is used, then the authorize() is not called, but instead the refresh() is called. Unfortunately, the refresh() method is a void-method.
Am I supposed to throw an exception here, in case of rejection of the refresh, or is this an information-only method, and there no way to prevent the rejection?
Hi! There is the possibility to create Queues from Apex with this code:
Group g = new Group(Name = 'Lead Queue 1', Type = 'Queue');
insert g;

QueueSobject qo = new QueueSObject(QueueId=g.Id, SObjectType = 'Lead');
insert qo;

Also, we can add members to the Queue like this:
GroupMember gm = new GroupMember(GroupId = g.Id, UserOrGroupId = UserInfo.getUserId());
insert gm;

But, a Queue also get a ListView created, where the SObjects (in this case Leads) are filtered by the Queue ownership. How do we also enable specific users to get visibility to that Queue ListView? I know it's possible manually through the UI, by editing the ListView and adding the users under "Step 4. Restrict Visibility", but is it possible in Apex?
Hi there! I have a requirement for a customer to provide funtionality that allows for Opportunites to be assigned to 1 user or a group of users based on criteria that needs to be configurable. Now, my idea is to use a custom object (or custom setting) to handle the criteria definition, and assign the opportunity using a trigger to assign the owner, and in case of user groups use the Opportunity Team. My question is, has anybody implemented something similar and maybe done it in a better way? Does anybody have any recommenations for this?
Hi,

if I want to implement a SSO integration between SF and MSAD (IdP), and I decide to use Identity Connect for the user-synchronization, do I still need the MS ADFS for the SSO? In the description of Identity Connect it says that it can act as the Identity Server Provider between SF and AD, but as far as I understand it, this is "usually" done by MS ADFS.

 
Hi all! I have a question regarding certificates used to secure apex callouts with two-way-ssl connections. How is the client certificate (e.g. the self-signed certificate generated in SF) secured? Can it be "stolen", or is it registered against the my-domain of the org it has been generated in? Or is it registered against *.force.com, or is there no domain verification at all?
In Lightning Components there are 3 possibilities for using javascript:
1) in the controller
2) in the helper
3) in a static resource.
3) is meant to be used for generic code, so if I want to write code specific for a component I should use 1) or 2). But 1) and 2) are both stateless, allowing only to store/retrieve state through aura-attributes, which seems to be not very convenient to list variables only used for state saving in the attributes. Is there any other way to store state in Lightning components?
I have a problem with a static resource containing javascript, which is used in a Lightning Component. Since Lightning uses <ltng:require> to retrieve static resources, which refers to the static resource only with the name (i.e. without a timestamp like it was in Visualforce), the component always uses a cached version of the static resource. This means changes done in the static resource are not reflected in the component...
Am I doing something wrong, or is this a bug/feature of lightning components?
If we setup email relaying through our SMTP server, and send with Apex an Email, what will be the from address of the email? I assume it's the current user's email address, but I'm not sure. If it is, can it somehow be changed?
I am trying to add a custom Visualforce login page to my hybrid-remote app, which is connected to a SF community. What I have done is, created a Visualforce page, which collects the User's username and password and calls the following controller method:
 
public PageReference doLogin() {
	return Site.login(username, password, null);
}

When I try to login through a browser into the community, it works well. But, when I try to do it through the mobile app (created with SF Mobile SDK, i.e. forceios CLI), it gives me after clicking the login-button the following message:
"Can't connect to salesforce: The URL can't be shown".

What have I missed?
Thanks!
I have a problem with my hybrid-remote app build with the SF Mobile SDK. It is connected to a community (in XCode I have changed the SFDCOAuthLoginHost to the community domain). When the user logs in to the app, everything works. But when he tries to open the app after some time (my guess is, after the oauth token expires), the app just opens a blank screen. If he then closes the app, and re-opens it, it is working normally again.

In SF debug logs, I can see that the app is loading the "/apex/CommunitiesLogin" again and again. But it never ends up in the actual community.

Steps to reproduce the issue:
1) Create a community in your org, and a partner user for the community.
2) Create a conected app for the mobile app.
2) Create a new hybrid remote app, using the forceios CLI.
3) Open the hybrid app in XCode, and change the login URL to the communities' URL.
4) Run the app in a simulator (it shows the login page of the community)
5) Enter the credentials of the user, and login. -> App shows the community.
6) Go on your computer to the Salesforce org, and to Setup > Security Controls > Session Management.
7) Mark all items belonging to the community user, and click on "Remove" (this is to simulate the oauth token expiring)
8) In the simulator, close the app, and re-run.
9) The app shows only a blank screen.

Additional info:
- The connected app has all scopes available
- The issue is not occurring, when I try this with a full-license user login through the app (but, of course, he does not end up in the community)
Hi! I am trying to setup push notifications for an app on iOS. Unfortunately the developer guide is not very clear, if you have no experience with iOS development...
So, the developer guide says: "Salesforce Mobile SDK for iOS provides the SFPushNotificationManager class to handle push registration. To use it, import <SalesforceSDKCore/SFPushNotificationManager>". How/Where/From where do I import this?
Is there maybe some tutorial explaining it step-by-step?
Is there a limit on the number of Emails that can be sent through Apex to community users? The documentation says it is 1000 (for single email) to external addresses, and unlimited to internal users. What about (customer/partner) community users?
I'm developing a hybrid (local) app in XCode. It has been setup with the forceios command line.
In XCode there are 2 www-folders - 1) At the top level, 2) in the Staging folder. When I change something in the 1), it is not displayed in the resulting app, until I run "cordova prepare" in the command line. This command line migrates the changes to the Staging folder. On the other hand, if I try to change the Staging folder, it asks me to unlock the file.
What is the correct way of development in this case? Do I need to run the cordova prepare line before every test-run?
Hi, is it possible to have a custom login page in a hybrid local app?
I have tried to use the technique described in the Developer Guide p. 257, i.e. changing the login URL to a community login which can be customized. It works, but then the app ends up in the community itself, and not back in the app (in the index.html file of the app), as expected.
Am I doing something wrong? Should I customize the login page in some other fashion?
I have read somewhere, that Apple revision will reject apps which just redirect the user to a remote page (e.g. Salesforce). Is this true? Does this mean that Hybrid Remote apps will be rejected by Apple revision?
Hi there,

I need a custom Connected App authorization mechanism (depending on certain data in the org, I want to accept or reject the authorization for a user). Now, I understand this could maybe be achieved by implementing the Auth.ConnectedAppPlugin and setting it as the Custom Connected App Handler for my Connected App. Unfortunately, there are no resources explaining details about the implementation of this interface, and it's not really working for me. I have 2 question:

Question 1)
I have created a test version of the handler-class, where the authorize() simply always returns false:
public override Boolean authorize(Id userId, Id connectedAppId, Boolean isAdminApproved) {
	return false;
}

public override Boolean authorize(Id userId, Id connectedAppId, Boolean isAdminApproved, Auth.InvocationContext context) {
	return false;        
}
When the user tries to authorize for the first time, this fails.
In the next step I have changed the implementation to always return true. After that, the user was able to authorize.
In the final step I have changed the implementation back to return false. After that, the user was still able to authorize!
Why is that? Can this be avoided somehow?

Question 2)
How can I prevent authorization in the refresh process? My guess is, when the refresh token is used, then the authorize() is not called, but instead the refresh() is called. Unfortunately, the refresh() method is a void-method.
Am I supposed to throw an exception here, in case of rejection of the refresh, or is this an information-only method, and there no way to prevent the rejection?
I have created a custom Lightning Component, implementing "force:LightningQuickAction,force:hasRecordId", because it should be used on the Case object as a custom action. Now, on Cases it seems that the custom actions are not showing (as for the other objects) in the Hightlighs Panel, alongside the standard buttons (e.g. Edit), but instead they show up in the Chatter Publisher.
So, my 1st question would be - can the action be somehow moved up to the Highlights Panel?

If not, then I have the following problem with the custom action being in the Chatter Publisher. When clicking on the button for the custom action inside the Chatter Publisher, the Lightning Component is shown. BUT, it also shows the default Lightning Experience "placeholder", which is usually shown only while a component is loading. In this case the placeholder stays forever (also after the component was loaded):

User-added image

Has anyone an idea what the problem is? Maybe the components shown inside the Chatter Publisher should implement a different interface, i.e. not "force:LightningQuickAction" ?
I have the following situation: 
There is a lightning component which shows a canvas html-element, and is used to render a chart. For some reason (which I will not explain here), when I want to redraw the chart, I need to:
1) destroy the existing canvas element,
and
2) create a new canvas element instead.
How can I do this with Lightning Components? Do I need to use the LC Renderer ?
Hi! There is the possibility to create Queues from Apex with this code:
Group g = new Group(Name = 'Lead Queue 1', Type = 'Queue');
insert g;

QueueSobject qo = new QueueSObject(QueueId=g.Id, SObjectType = 'Lead');
insert qo;

Also, we can add members to the Queue like this:
GroupMember gm = new GroupMember(GroupId = g.Id, UserOrGroupId = UserInfo.getUserId());
insert gm;

But, a Queue also get a ListView created, where the SObjects (in this case Leads) are filtered by the Queue ownership. How do we also enable specific users to get visibility to that Queue ListView? I know it's possible manually through the UI, by editing the ListView and adding the users under "Step 4. Restrict Visibility", but is it possible in Apex?
Hi all! I have a question regarding certificates used to secure apex callouts with two-way-ssl connections. How is the client certificate (e.g. the self-signed certificate generated in SF) secured? Can it be "stolen", or is it registered against the my-domain of the org it has been generated in? Or is it registered against *.force.com, or is there no domain verification at all?
Hi  
  In my application,if i call the same method to connect different web services , will it affect the performance? The number of connection to web service per day may exceed 2000 times and we are using unlimited version.Shall i keep seperate method to connect each web service? which is the best way to do web service? please advise.
thanks
Hi Guys,
Requirement: Update Contact Mailing address with Account Address when a link is clicked in contacts pagelayout
What I have done: I have created a link in contact (when clicked it update the mailing address of contacts with accounts Updated address).
                             Execute Javascript with the code

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

//alert('{!Contact.Id}{!Account.BillingCity}{!Account.BillingCountry}');

callback = sforce.apex.execute("MyWebService","myMethod",{billingcity:'{!Account.BillingCity}'},{billingCountry:'{!Account.BillingCountry}'},{billingState:'{!Account.BillingState}'},{contactId:'{!Contact.Id}'});

if(callback== 'OK'){
window.location.reload();
}
else{

alert('Error:' + callback);
}

And Have written an Apex code :

global class MyWebService {
    
/*    webservice static void myMethod(String billingcity, String billingCountry, String billingState,Id contactId ){
        Contact con = new Contact(Id=contactId,
                                  mailingCity=billingcity,
                                  mailingCountry=billingCountry,
                                  mailingState =billingState);
        update con;
    }*/
    
  //  webservice static void updateContact(Id contactId ){
    webservice static void myMethod(Id contactId ){
        List<Contact> conList = [select id, Account.billingcity,
                                   Account.billingCountry,Account.billingState
                                   From Contact Where id=:contactId ];
        Contact con = new Contact(Id=contactId,
                                  mailingCity=conList[0].Account.billingcity,
                                  mailingCountry=conList[0].Account.billingCountry,
                                  mailingState =conList[0].Account.billingState);
        update con;
    }

}

It gives errors and not updating the address.
Please help.Though the code looks small I am unable to debug where I am going wrong.

Error message is:OnSuccess not defined in the callBack.
 
Please help 
Doubt:Cant I use synchronoue or asynchronous ajax tool method..

I have also tried 
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

// identify the record 
//var o = new sforce.SObject("Contact"); 
//var a= new sforce.SObject("Account"); 

var result = sforce.connection.query("SELECT "c.accountId " + "FROM Contact c, c.account a"); 



// make the field change 
c.mailingCity=c.account.billingcity; 
c.mailingCountry=c.account.billingCountry; 
c.mailingState =c.account.billingState; 


// save the change 
sforce.connection.update([c]); 

//refresh the page 
//window.location.reload();
Error for this code is :Unexpected token illegal.
 
Hi! I am trying to setup push notifications for an app on iOS. Unfortunately the developer guide is not very clear, if you have no experience with iOS development...
So, the developer guide says: "Salesforce Mobile SDK for iOS provides the SFPushNotificationManager class to handle push registration. To use it, import <SalesforceSDKCore/SFPushNotificationManager>". How/Where/From where do I import this?
Is there maybe some tutorial explaining it step-by-step?
Hi, is it possible to have a custom login page in a hybrid local app?
I have tried to use the technique described in the Developer Guide p. 257, i.e. changing the login URL to a community login which can be customized. It works, but then the app ends up in the community itself, and not back in the app (in the index.html file of the app), as expected.
Am I doing something wrong? Should I customize the login page in some other fashion?