-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
5Questions
-
2Replies
Generate a debug log for an Apex class that runs when a report is exported
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?
-
- rfg
- October 07, 2022
- Like
- 0
- Continue reading or reply
Choose which fields are included in a Knowledge Base translation export
- `Question`
- `Answer`
- `Member Information` (a custom field we created on the Knowledge object).
How can I set which fields will be included in the export?
-
- rfg
- July 13, 2021
- Like
- 0
- Continue reading or reply
How to pass record ID to 'Launch Flow in Modal' component in Lightning community
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:
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?
-
- rfg
- August 31, 2020
- Like
- 1
- Continue reading or reply
How to create a link to a specific community record detail page by passing the 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
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%3Dp1so 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?
-
- rfg
- August 28, 2020
- Like
- 0
- Continue reading or reply
How to create a popup to select related records?
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?
-
- rfg
- July 29, 2019
- Like
- 0
- Continue reading or reply
How to pass record ID to 'Launch Flow in Modal' component in Lightning community
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:
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?
-
- rfg
- August 31, 2020
- Like
- 1
- Continue reading or reply
Generate a debug log for an Apex class that runs when a report is exported
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?
- rfg
- October 07, 2022
- Like
- 0
- Continue reading or reply
Community component that redirects to custom object detail page?
({ 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); } })
- Spencer Berk
- December 07, 2019
- Like
- 0
- Continue reading or reply