• Shiva SFDeveloper
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hello everyone,

We have a custom button on Account object that calls a visualforce page. The visualforce page has a page action that redirects the user to the standard New Opportunity page Edit screen with some prefilled fields. This has been working fine for the past few months. 

However, recently, we have observed that when we click the button, a blank screen appears with the URL as 
https://instance-name--c.cs71.visual.force.com/apex/CreateOpportunity?scontrolCaching=1&id=xxxxxxxxxxxxx
and only upon refreshing this page, it redirects to the New Opportunity page. This is adding an additional step for all the users many of whom are not actually aware that refreshing can redirect in the first place and it is causing some friction in the daily activities. 

This is happening only with Chrome browser. Has anyone seen a similar behavior or aware of a possible cause/fix?  

Another thing, when Chrome inspect/console is opened, it works fine. It does show a warining message that "HTTP-Based Public Key Pinning is deprecated. Chrome 69 and later will ignore HPKP response headers." ; not sure if it related at all to the re-direct issue.

Any help/inputs will be appreciated.
Hi,
I am trying to find the different events upon which we receive notifications under the Bell icon.
User-added image
Some of them I have observed so far is
a. When there are Chatter mentions
b. Approval Request notifications
c. Transaction Security notifications

Q1. Are there any other events upon which we might be receiving the notifications? 

Q2. Can we configure custom notifications to be appearing under the bell? For example, change of status field on a cutom object.  We can configure email alerts using Workflows or Process Builder, but I am also looking if I can be notified in Salesforce, for different events.

Appreciate any pointers. Thanks in advance.

- Shiva
I am creating a Transaction Security Policy as per the example in the trail head. When creating the test class, it was giving me errors saying Platform field is not writeable. We also won't be able to create a new LoginHistory record. What is a better way to write the test class for this policy class to properly assert and verify the functionality? Any pointers would be appreciated. Thanks in advance!
 
global class BlockAndroidPolicyCondition implements TxnSecurity.PolicyCondition {
  public boolean evaluate(TxnSecurity.Event e) {
    LoginHistory eObj = [SELECT Platform FROM LoginHistory
                         WHERE Id = :e.data.get('LoginHistoryId')];
    if (eObj != null) {
      if (eObj.Platform.contains('Android') &&  
          eObj.Platform.compareTo('Android 5') < 0) { 
        return true;
      }
    }
    return false;
  }
}
@isTest
public class TestBlockAndroid {
  public static testMethod void testIsAndroid() {

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';

    /* Create a map for the event we’re going to build. */
    Map<String, String> eventData = new Map<String, String>();

    /* Insert the LoginHistoryId into the event data map. */
    insert loginHistoryObj;
    eventData.put('LoginHistoryId', loginHistoryObj.id);

    TxnSecurity.Event e = new TxnSecurity.Event(
      '00Dxxx123123123', /* organizationId */
      '005xxx123123123', /* userId */
      'AuthSession', /* entityName */
      'Login', /* action */
      'LoginHistory', /* resourceType */
      '01pR00000009D2H', /* entityId */
      Datetime.newInstance(2016, 2, 15), /* timeStamp */
      eventData); /* data - Map with info about this event. */

    BlockAndroidPolicyCondition condition =
      new BlockAndroidPolicyCondition();

    System.assertEquals(true, condition.evaluate(e));
  }
}



 
Hi,

I am looking for any possible way/option to change the Tigger header from "Error" to my custom heading.

User-added image

I am using the Trigger adderror() method to basically stop the current flow and display a html message in it. User will navigate to another page by the URL in the HTML message.

Now, everything is going fine and it's just the header message that is showing as "Error". I want to display a custom message over there..

Any pointers would be greatly appreciated..

Thanks in advance!!
Shiva
Hi,
I am trying to find the different events upon which we receive notifications under the Bell icon.
User-added image
Some of them I have observed so far is
a. When there are Chatter mentions
b. Approval Request notifications
c. Transaction Security notifications

Q1. Are there any other events upon which we might be receiving the notifications? 

Q2. Can we configure custom notifications to be appearing under the bell? For example, change of status field on a cutom object.  We can configure email alerts using Workflows or Process Builder, but I am also looking if I can be notified in Salesforce, for different events.

Appreciate any pointers. Thanks in advance.

- Shiva
I am creating a Transaction Security Policy as per the example in the trail head. When creating the test class, it was giving me errors saying Platform field is not writeable. We also won't be able to create a new LoginHistory record. What is a better way to write the test class for this policy class to properly assert and verify the functionality? Any pointers would be appreciated. Thanks in advance!
 
global class BlockAndroidPolicyCondition implements TxnSecurity.PolicyCondition {
  public boolean evaluate(TxnSecurity.Event e) {
    LoginHistory eObj = [SELECT Platform FROM LoginHistory
                         WHERE Id = :e.data.get('LoginHistoryId')];
    if (eObj != null) {
      if (eObj.Platform.contains('Android') &&  
          eObj.Platform.compareTo('Android 5') < 0) { 
        return true;
      }
    }
    return false;
  }
}
@isTest
public class TestBlockAndroid {
  public static testMethod void testIsAndroid() {

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';

    /* Create a map for the event we’re going to build. */
    Map<String, String> eventData = new Map<String, String>();

    /* Insert the LoginHistoryId into the event data map. */
    insert loginHistoryObj;
    eventData.put('LoginHistoryId', loginHistoryObj.id);

    TxnSecurity.Event e = new TxnSecurity.Event(
      '00Dxxx123123123', /* organizationId */
      '005xxx123123123', /* userId */
      'AuthSession', /* entityName */
      'Login', /* action */
      'LoginHistory', /* resourceType */
      '01pR00000009D2H', /* entityId */
      Datetime.newInstance(2016, 2, 15), /* timeStamp */
      eventData); /* data - Map with info about this event. */

    BlockAndroidPolicyCondition condition =
      new BlockAndroidPolicyCondition();

    System.assertEquals(true, condition.evaluate(e));
  }
}