• rfg
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies

I'm trying to create an Apex Condition on a Transaction Security Policy. The code runs when a user attempts to export a report. The code I'm trying to modify looks like this:

global class BlockLargeDataExportEventCondition implements TxnSecurity.EventCondition {
    public boolean evaluate(SObject event) {
        switch on event{
            when ReportEvent reportEvent {
                return evaluate(reportEvent);
            }
            when null {
                // Don't take policy action when event is null
                return false;
            }
            when else{
                // Don't take policy action when event is not handled
                return false;
            }
        }
    }
    /**
     * Handle evaluating ReportEvent
     */
    private boolean evaluate(ReportEvent reportEvent){
        Profile profile = [SELECT Name FROM Profile WHERE Id IN
                            (SELECT profileId FROM User WHERE Id = :reportEvent.UserId)];
        // Take policy action only if the user profile is not 'System Administrator' and
        // RowsProcessed greater than 250.
        if (!profile.Name.contains('System Administrator')
            && ReportEvent.Operation.equals ('ReportExported')
            && reportEvent.RowsProcessed > 250) {
            return true;
        }
        return false;
    }
}
But I can't seem to get any debug logs generated, so when I try to `System.debug` my variables (I'm trying to modify this to check for a specific permission set instead of a Profile), I can't see why it's not working. I'm trying to activate a debug log for my User. I get logs for other things my user account does (like edit the Apex class), but no logs are generated when I export a report. Any idea what I'm doing wrong?
  • October 07, 2022
  • Like
  • 0
I have followed the instructions (https://help.salesforce.com/articleView?id=sf.knowledge_translation_export.htm&type=5) to assign knowledge articles to a queue and export them, and it's working fine but it only exports 3 fields for each article:
  • `Question`
  • `Answer`
  • `Member Information` (a custom field we created on the Knowledge object).
I also need it to export the `Summary` and `Title` fields, but I can't figure out where to set that up.

How can I set which fields will be included in the export?
  • July 13, 2021
  • Like
  • 0
I am trying to use the 'Launch Flow in Modal' component in a Lightning Community. I'm placing this button on a Contact record detail page in the Community, and I want to pass the Contact Id to the flow as the input variable 'recordId'.

The options for the component include a field called Flow Input Variables, and the 'info' tooltip for that field gives a syntax example for a JSON string to set the variable that looks like this:

User-added image

I can't figure out how to get the record Id of the current contact from the contact detail page inserted into the flow.

First I tried
 
[{"name": "recordId", "type": "String", "value": {!Record.Id}}]

but that throws this error:
SyntaxError: JSON.parse: unexpected character at line 1 column 51 of the JSON data

I figured the brackets around the variable were the problem so I tried escaping them with backslashes:
 
[{"name": "recordId", "type": "String", "value": \{!Record.Id\}}]

but got the same error.

What's the right way to reference the Id of the current record from a community record detail page to pass to a flow?
  • August 31, 2020
  • Like
  • 1
I'm trying to create a link to a specific record detail page in a lightning community from a VF page, by passing the record ID as a variable.

The community record detail page I want to navigate to has a URL that looks like {BaseURL}/s/attendee/{RecordId}

The code I'm trying looks like:
 
<apex:outputLink value="{!URLFOR('/s/attendee/' + a.Id)}" >
    <apex:outputText value="Modify or cancel"/>
</apex:outputLink>
(where a.Id is the Id for the EventAttendee record that I want to navigate to)

When I use this code and roll over the link on the rendered VF page, I see

User-added image
 
javascript:srcUp('/my503live/s/attendee/a6G4N000000H05wUAC?isdtp=p1');
which looks almost right -- minus the ?isdtp=p1 part.

But when I actually click the link, it takes me to
 
{BASEURL}/my503live/s/sfdcpage/%2Fapex%2Fs%2Fattendee%2Fa6G4N000000H05wUAC%3Fisdtp%3Dp1
so I'm obviously missing something to escape or URLencode the special characters, plus it's inserting /sfdcpage/ and apex in front of the part I want and isdtp=p1 after it.

What's the right way to build a formula for a URL inside an <apex:outputLink /> tag?
  • August 28, 2020
  • Like
  • 0

Seems like this should be easy to do but I can't figure it out.

I have a custom object called eVoter. eVoter requires a related Contact Id to save. A Contact can have more than one related eVoter record. eVoter stores the related Contact ID, but Contact does not store any reference to the eVoter object.

I want to create a button or link on the Contact detail page that would pull up a list of all eVoter records that are related to the given Contact record (by searching for the matching contact ID), allow the user to select the correct record, and then link to the selected eVoter detail page. It seems like this should not be complicated but I can't find an example to get me started. Can somebody point me to some example code for creating a link or button like this?

  • July 29, 2019
  • Like
  • 0
I am trying to use the 'Launch Flow in Modal' component in a Lightning Community. I'm placing this button on a Contact record detail page in the Community, and I want to pass the Contact Id to the flow as the input variable 'recordId'.

The options for the component include a field called Flow Input Variables, and the 'info' tooltip for that field gives a syntax example for a JSON string to set the variable that looks like this:

User-added image

I can't figure out how to get the record Id of the current contact from the contact detail page inserted into the flow.

First I tried
 
[{"name": "recordId", "type": "String", "value": {!Record.Id}}]

but that throws this error:
SyntaxError: JSON.parse: unexpected character at line 1 column 51 of the JSON data

I figured the brackets around the variable were the problem so I tried escaping them with backslashes:
 
[{"name": "recordId", "type": "String", "value": \{!Record.Id\}}]

but got the same error.

What's the right way to reference the Id of the current record from a community record detail page to pass to a flow?
  • August 31, 2020
  • Like
  • 1

I'm trying to create an Apex Condition on a Transaction Security Policy. The code runs when a user attempts to export a report. The code I'm trying to modify looks like this:

global class BlockLargeDataExportEventCondition implements TxnSecurity.EventCondition {
    public boolean evaluate(SObject event) {
        switch on event{
            when ReportEvent reportEvent {
                return evaluate(reportEvent);
            }
            when null {
                // Don't take policy action when event is null
                return false;
            }
            when else{
                // Don't take policy action when event is not handled
                return false;
            }
        }
    }
    /**
     * Handle evaluating ReportEvent
     */
    private boolean evaluate(ReportEvent reportEvent){
        Profile profile = [SELECT Name FROM Profile WHERE Id IN
                            (SELECT profileId FROM User WHERE Id = :reportEvent.UserId)];
        // Take policy action only if the user profile is not 'System Administrator' and
        // RowsProcessed greater than 250.
        if (!profile.Name.contains('System Administrator')
            && ReportEvent.Operation.equals ('ReportExported')
            && reportEvent.RowsProcessed > 250) {
            return true;
        }
        return false;
    }
}
But I can't seem to get any debug logs generated, so when I try to `System.debug` my variables (I'm trying to modify this to check for a specific permission set instead of a Profile), I can't see why it's not working. I'm trying to activate a debug log for my User. I get logs for other things my user account does (like edit the Apex class), but no logs are generated when I export a report. Any idea what I'm doing wrong?
  • October 07, 2022
  • Like
  • 0
This component redirects a community user to the user's Account Detail page in a community. How would I change the code to redirect to a custom object (Billing__c) Detail page? I've tried changing the recordId path to LoggedInUser.Contact.AccountId.Billing__c with no luck. My path might be wrong. I am not a developer so any advice would be greatly appreciated.
({
    redirectToAccount: function(component, event, helper) {
        var loggedInUser;
        var state;
        var navEvt;
        
        var action = component.get("c.getLoggedInUser");
        action.setCallback(this, function(response) {
            state = response.getState();
            if (state === "SUCCESS") {
                loggedInUser = response.getReturnValue();
                navEvt = $A.get("e.force:navigateToSObject");
                navEvt.setParams({
                    "recordId": loggedInUser.Contact.AccountId,
                    "slideDevName": "detail"
                });
                navEvt.fire();
            }
        });
        $A.enqueueAction(action);
    }
})