• Azeez Thummalapalli
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Developer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
As per Summer'20 Release notes 'Help Chat Agents Respond Faster with Einstein Reply Recommendations' is generally avaialble.
But I don't see 'Reply Recommendations' in setup both in Lightning and classic. Is this future generally avaialable? or does it require any extra setup?
I am trying to use Continuation concept for making Asynchronous webservice call from Lightning Component. 

As per the syntax given in documentation,  I have annotated the continution method with 
@AuraEnabled(continuation=true)


and callback method as just 
@AuraEnabled


When trying to execute this from UI, I am getting the below error message:
Error message: Apex methods that are to be cached must be marked as @AuraEnabled(cacheable=true)


If I add 'cacheable=true' to callback method, then I am unable to perform DML opeartion in it. Ideally, after completing webservice call we must be able to perofrm DMLs, and this works in VFpage but not in Lightning Component. 

Could you please suggest any solution or workaround. Thank you in advance.
 
I am using `Platform Events`, to fire a webservice(HTTP request) call post transaction commit, let us say Once Account is Created or Account Updated. In the process of doing so, I am able to create/publish Platform Events from the (Account/any Object) Triggers.

Trigger as PlatformEvent Subscriber:
As a Platform Event subscriber, I have written a Trigger on PlatformEvent. Logic written inside the trigger is not completely working, in other words partially working. In detail, in the logic I have added Debug satements as a first line and my further logic is to query a record and send those details in a webservice(HTTP) and update a record based on the HTTPResponse received. 

In this scenario, debug statement is getting executed but neither query nor webservice call happening. I assume this is because of '`Automated Process`' user do not have enough permissions on Object (to query) or Apex class( to invoke)from Trigger. I believe, we do not have any control on this user or it's profile. Correct me if I am wrong?

Work around I have used: The same logic is written in an Invocable method and used ProcessBuilder as PlatformEvent sbscriber. This is working perfectly.

Query: Is it a known issue that we cannot use Triggers as PlatformEvent subscriber? If not, do we have any approach to change Automated Process user's profile permissions? Please help. Thank you in advance.
Object_A and Object_B are two related(Lookup) objects in Salesforce, where A is parent and B is child. Requirement is, when a new Object_B record is created, an email alert should be sent to Object_B owner(not necessarily who created, because we are setting the owner in code), to parent Object_A record Owner, and to one who created parent Object_A record. Note that these owners can be Queues or users, and they can be same for both the records(i.e. object_A and Object_B records may or may not have same owners). Note that, no one should receive duplicate email alerts for the same object_B record.

For the above scenario, to send email alerts, we can use either Workflow email alerts or Custom Code to send emails. Below I am providing my opinions on both the approaches. I believe, in this case custom code makes more sense than declarative approach. Please correct me if I am wrong, by looking at the below explanation.

Workflow/ProcessBuilder Email alerts
  • I may need to create multiple workflows to make sure that duplicate email alerts are not sent. Of course, we can use Process Builder in this case. But still if the owners are Queues and a few users are part of both of those two queues, then it will be difficult ensure that duplicate emails are not sent.
  • The limit for Email alerts via workflows is 1000 per licence per day. So the email alerts counting towards the governor limits.

Custom Code using Messaging.SingleEmailMessage
  • Define a new static method in a helper class, and write logic to send email using Messaging.SingleEmailMessage, and in code we can make sure that duplicate email alerts are not sent to same user for same Object_B record. Call this method from After Trigger.
  • Though there are governor limits, sending emails to internal users will not be counted towards the governor limits. I believe, this is the best because there is no chance to get governor limit exception in this case.
Is my analysis correct? Is there any other best approach?
Till I post this question, I was in assumption that the answer for my question is "No, it is not possible to update owner of a record to a user who does not have Read access at the object level". But, my simple tiny program made me so confused.

Here is the scenario, Let us consider there are two users:
  1. 'Admin User'(Myslef) - having System Admin profile
  2. 'Restricted User' - having some custom profile, and does not have read access on Account object. Do not have View All an Modify All permissions, and no other permission sets are assigned.
Now, I(Admin user) have created an Account record in standard UI; let's say A1 is the record. As expected in this case, the user who created becomes the owner by default.

Now, when I try to change the owner of that record to 'Restricted User'(who does not have read access on Account) in Standard UI by clicking on 'Change' link at the owner field, I am getting 'Transfer Requires Read - The new owner must have "Read" permissions on this type of record.' error. This is expected, as per my knowledge.

But, when I try to change the owner of that record to 'Restricted User'(who does not have read access on Account) using Apex, I am able to change the owner successfully, which I didn't expect. I have used the below code for updating the owner:
Account acc = new Account();
acc.Id='00190000024XXXX'; //Record Id 
acc.OwnerId = '0059000000XXXXX'; //Restricted User Id 
update acc;
I have tried this in three different places/ways: 1.Running as Anonymous Code in Developer Console, 2.in Apex Cpntroller using Without Sharing, 3.in Apex Cpntroller using With Sharing. It is getting succeeded in all the three ways.

One more observation in the same scenario is, though the 'Restricted User' became owner of the record, he is getting insufficient privileges while trying to access the record. I think, this is somehow okay, because Profile permission takes the high priority than anything else while deciding the accessibility.

Can some help me to understand, if this is expected behavior, or is there any silly mistake that I might be doing.

Apex document clearly says, 'Scientific notation (e) for Doubles is not supported'. But again, Salesforce Object Reference guide says, 'Values can be stored in scientific notation if the number is large enough, or small enough negative'. So, here is the ambiguity.
As per my experience and knowledge in Salesforce, when I re-read the statements it seems they are correct. But I wanted to confirm the same here, if my analysis is correct.
So, the actual meaning of the above statements is "yes, double values does not allow scientific notations, and even double type fields (Currency, Percent) does not allow user to enter scientific notation as value in UI. But, internally if the value is too small or large then the value can be stored as scientific notation in database, and it may return the value in scientific notation when retrieved in dataloader"
Correct me if I am wrong, and clarify the ambiguity.

Thank you.

I am using Async WSDL classes in conjuction with the Continuation class. Is there any place in Salesforce UI, where can I see the async call created from my Contnuation code. I have searched in the Apex Jobs, but I couldn't see my job in the list. And also my callback method is also not called, I am assuming this, but not sure. So, how can I come to know that my Callback method is called, after the response is received from the aync callout. Please assist on the same.

As per Summer'20 Release notes 'Help Chat Agents Respond Faster with Einstein Reply Recommendations' is generally avaialble.
But I don't see 'Reply Recommendations' in setup both in Lightning and classic. Is this future generally avaialable? or does it require any extra setup?
I am trying to use Continuation concept for making Asynchronous webservice call from Lightning Component. 

As per the syntax given in documentation,  I have annotated the continution method with 
@AuraEnabled(continuation=true)


and callback method as just 
@AuraEnabled


When trying to execute this from UI, I am getting the below error message:
Error message: Apex methods that are to be cached must be marked as @AuraEnabled(cacheable=true)


If I add 'cacheable=true' to callback method, then I am unable to perform DML opeartion in it. Ideally, after completing webservice call we must be able to perofrm DMLs, and this works in VFpage but not in Lightning Component. 

Could you please suggest any solution or workaround. Thank you in advance.
 
Till I post this question, I was in assumption that the answer for my question is "No, it is not possible to update owner of a record to a user who does not have Read access at the object level". But, my simple tiny program made me so confused.

Here is the scenario, Let us consider there are two users:
  1. 'Admin User'(Myslef) - having System Admin profile
  2. 'Restricted User' - having some custom profile, and does not have read access on Account object. Do not have View All an Modify All permissions, and no other permission sets are assigned.
Now, I(Admin user) have created an Account record in standard UI; let's say A1 is the record. As expected in this case, the user who created becomes the owner by default.

Now, when I try to change the owner of that record to 'Restricted User'(who does not have read access on Account) in Standard UI by clicking on 'Change' link at the owner field, I am getting 'Transfer Requires Read - The new owner must have "Read" permissions on this type of record.' error. This is expected, as per my knowledge.

But, when I try to change the owner of that record to 'Restricted User'(who does not have read access on Account) using Apex, I am able to change the owner successfully, which I didn't expect. I have used the below code for updating the owner:
Account acc = new Account();
acc.Id='00190000024XXXX'; //Record Id 
acc.OwnerId = '0059000000XXXXX'; //Restricted User Id 
update acc;
I have tried this in three different places/ways: 1.Running as Anonymous Code in Developer Console, 2.in Apex Cpntroller using Without Sharing, 3.in Apex Cpntroller using With Sharing. It is getting succeeded in all the three ways.

One more observation in the same scenario is, though the 'Restricted User' became owner of the record, he is getting insufficient privileges while trying to access the record. I think, this is somehow okay, because Profile permission takes the high priority than anything else while deciding the accessibility.

Can some help me to understand, if this is expected behavior, or is there any silly mistake that I might be doing.

Apex document clearly says, 'Scientific notation (e) for Doubles is not supported'. But again, Salesforce Object Reference guide says, 'Values can be stored in scientific notation if the number is large enough, or small enough negative'. So, here is the ambiguity.
As per my experience and knowledge in Salesforce, when I re-read the statements it seems they are correct. But I wanted to confirm the same here, if my analysis is correct.
So, the actual meaning of the above statements is "yes, double values does not allow scientific notations, and even double type fields (Currency, Percent) does not allow user to enter scientific notation as value in UI. But, internally if the value is too small or large then the value can be stored as scientific notation in database, and it may return the value in scientific notation when retrieved in dataloader"
Correct me if I am wrong, and clarify the ambiguity.

Thank you.

Hi

I am trying to query my standard pricebook in my apex method by following code,

PriceBook2 PB=[select id,Name from Pricebook2 where IsStandard = true];

Im getting the result in my application but when i write test class and call the method containing that code im getting the following error,

System.QueryException: List has no rows for assignment to SObject.

finally i did my test class using seealldata=true and im able to get the results

What is the reason for this?

 
 
  • September 20, 2016
  • Like
  • 0