-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
12Questions
-
19Replies
Process Builder to use Custom Settings?
- Katherine Rowe
- December 07, 2016
- Like
- 0
- Continue reading or reply
Using a loop with a custom setting in a trigger
I want to use a custom setting to hold mapping for a field. For example, if the user selects the Industry field as "Utilities & Water", then I want the trigger to go to the Custom Setting to find the appropriate value for that industry and put it in the field LOB, which in this example would be "Utilities & Communications". I started off not using a loop, and just using getInstance(), like below but then I realized some of my industry values are more than 40 characters which won't work with the Custom Setting name field.
trigger MapLOBTrigger on Account (before update, before insert) { for(Account a1: Trigger.new){ if(MappingLOB__c.getInstance(a1.Industry) != null){ a1.Industry=MappingLOB__c.getInstance(a1.Industry).LOB__c; } } }
So now I have tried added a custom field called Industry on my custom setting to use instead of the name field. But I think I've been told I can't use getInstance() and I have to instead use getAll() and a loop to sort through all the values in the Custom Setting? Maybe a List?
- Katherine Rowe
- October 12, 2016
- Like
- 0
- Continue reading or reply
Trigger for data.com records only
How can I write my trigger to detect whether the account is coming from data.com or not? Is there a "best practice" way of doing this?
- Katherine Rowe
- October 10, 2016
- Like
- 0
- Continue reading or reply
Best way to map values in a trigger - case vs else if
trigger MapDataCOMIndustry on Account (before insert, before update) { for(Account a1: Trigger.new){ if(a1.industry=='Government'){ a1.industry='Emergency Services'; } } }
Now I have to do that for a long list of industries, see below. What is the best way to write this in the trigger? Can I use something like a "case" method? Or does it need to be a bunch of else if statements?
trigger MapDataCOMIndustry on Account (before insert, before update) { for(Account a1: Trigger.new){ if(a1.industry=='Government'){ a1.industry='Emergency Services'; } else if(a1.industry=='Agriculture'){ a1.industry='Agriculture & Fisheries'; } else if(a1.industry=='Apparel'){ a1.industry='Other'; } else if(a1.industry=='Banking'){ a1.industry='Finance'; } } }
- Katherine Rowe
- October 07, 2016
- Like
- 0
- Continue reading or reply
Flow to delete opportunity team members
Goal: When opportunity ownership is transfered and the "Keep Opportuntiy Teams" box is selected, then I want the flow to automatically delete the opportunity team member for the previous owner. Because we have Splits enabled, the owner is always added as an opporutnity team member. And as soon as the owner becomes the previous owner, I want the corresponding team member to be automatically deleted. For example, Joe owns the opp, Joe and Mary are team members. The opp is transfered to Bob, and the desired result should be that Bob and Mary are the only team members.
So far, I've got a single step in my flow that deletes the team member nicely. But it only works when "Keep Opportunity Teams" is selected. If I don't select "Keep Opportunity Teams", then the flow throws an error. Presumably because the team member has already been deleted and the flow doesn't know what to do? I'm not sure how to modify my flow to deal with this.
After I get that sorted out, then I need to make sure it can delete any splits it needs to.
- Katherine Rowe
- August 24, 2016
- Like
- 0
- Continue reading or reply
Query to find all personal reports based on user's role
I want it to show me report id, report name, user name, user role for all users where role contains "abc". And then I would like to do the same query, but for users that are inactive instead of based on their role.
The example floating around in the documentation is below, but not sure how to incorporate the changes I want:
SELECT Id FROM Report USING SCOPE allPrivate WHERE LastRunDate < LAST_N_DAYS:365
- Katherine Rowe
- April 21, 2016
- Like
- 0
- Continue reading or reply
URL when using visual force page
For example, we have a visual force page for our opportunities. The first thing it's doing that I don't like, is its using the 18 character ID instead of the 15. Can we change it to use the 15 character ID? The second thing it's doing that I don't like, is its appending this thing at the end "?nooveride=1". Can we get rid of that? I guess what I'm saying is I want the URL to look exactly like it does for opportunities without visual force.
Current URL with visual force page:
https://intergraph.my.salesforce.com/0065700000misnKAAQ?nooverride=1
If I erase the last 3 characters of the ID and everything after it, the link still takes me to the opportunity, so I guess those things aren't really necessary? Then it's just a matter of is there a way to remove them?
https://intergraph.my.salesforce.com/0065700000misnK
- Katherine Rowe
- April 01, 2016
- Like
- 0
- Continue reading or reply
Why am I not getting exception emails every time?
Why does it only send an email the first time there is an unhandled exception? Is there some logic to explain this behavior?
This guy describes the same behavior here, but this was from 5 years ago:
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yXMIAY
I am actually testing something about the exception emails, so I want to keep receiving the actual email everytime my trigger throws an unhandled exception. I've tried adding my name to the Apex Exception Email list, but that didn't help with the frequency of emails.
- Katherine Rowe
- November 10, 2015
- Like
- 0
- Continue reading or reply
Need an example of an unhandled exception
I need a trigger that will throw an unhandled exception. I'm new to writing triggers, can someone help me whip one up? I'm testing the emails that SF sends out to the last modified user on the trigger, when there is an unhandled exception.
It can be really simple. I just want to be able easily fire the trigger in SF and for it to throw an unhandled exception.
- Katherine Rowe
- November 09, 2015
- Like
- 0
- Continue reading or reply
Unhandled exception sends email, can we stop that?
Disclaimer: Salesforce Admin here, not a developer.
The reason I don't want it to try and send an email is, we have Email Deliverability set to System Only in our test and dev environments. And sometimes when an action leads to a trigger failing, the error displayed is about the "NO_MASS_MAIL_PERMISSION" instead of the underlying cause. If I turn Email Deliverability to All Emails, then a more relevant error message then shows in its place, and we can then figure out the problem and deal with it. The triggers I'm referring to are in a managed package, so rewriting the trigger to perhaps handle exceptions better is not in our control. So for now, I want to see if we can simply stop SF from trying to email anyone at all...
When unhandled Apex exceptions occur, emails are sent that include the Apex stack trace and the customer’s org and user ID. No other customer data is returned with the report. Unhandled exception emails are sent by default to the developer specified in theLastModifiedBy field on the failing class or trigger.
What Happens When an Apex Exception Occurs?
https://help.salesforce.com/HTViewHelpDoc?id=code_apex_exceptions.htm
Error when Email Deliverability is set to System Only
Error when Email Deliverability is set to All Emails
- Katherine Rowe
- October 30, 2015
- Like
- 0
- Continue reading or reply
Eclipse error - Package Manifest Content Warning
Exception happened when resolving component type(s), so no component will be added to package manifest editor for these types.
*ExternalDataSource
See log for detail exception messages.
I'm not a developer, so I don't know much about eclipse. I'm using eclipse as a way to download the reports my users are using. So I can see what columns and criteria they're using. I just need to be able to pull this information from Salesforce, I won't be pushing any changes from Eclipse back to Salesforce.
- Katherine Rowe
- February 04, 2015
- Like
- 0
- Continue reading or reply
Locked out of my dev environment, how to unlock?
- Katherine Rowe
- January 15, 2015
- Like
- 0
- Continue reading or reply
Process Builder to use Custom Settings?
- Katherine Rowe
- December 07, 2016
- Like
- 0
- Continue reading or reply
Using a loop with a custom setting in a trigger
I want to use a custom setting to hold mapping for a field. For example, if the user selects the Industry field as "Utilities & Water", then I want the trigger to go to the Custom Setting to find the appropriate value for that industry and put it in the field LOB, which in this example would be "Utilities & Communications". I started off not using a loop, and just using getInstance(), like below but then I realized some of my industry values are more than 40 characters which won't work with the Custom Setting name field.
trigger MapLOBTrigger on Account (before update, before insert) { for(Account a1: Trigger.new){ if(MappingLOB__c.getInstance(a1.Industry) != null){ a1.Industry=MappingLOB__c.getInstance(a1.Industry).LOB__c; } } }
So now I have tried added a custom field called Industry on my custom setting to use instead of the name field. But I think I've been told I can't use getInstance() and I have to instead use getAll() and a loop to sort through all the values in the Custom Setting? Maybe a List?
- Katherine Rowe
- October 12, 2016
- Like
- 0
- Continue reading or reply
Trigger for data.com records only
How can I write my trigger to detect whether the account is coming from data.com or not? Is there a "best practice" way of doing this?
- Katherine Rowe
- October 10, 2016
- Like
- 0
- Continue reading or reply
Best way to map values in a trigger - case vs else if
trigger MapDataCOMIndustry on Account (before insert, before update) { for(Account a1: Trigger.new){ if(a1.industry=='Government'){ a1.industry='Emergency Services'; } } }
Now I have to do that for a long list of industries, see below. What is the best way to write this in the trigger? Can I use something like a "case" method? Or does it need to be a bunch of else if statements?
trigger MapDataCOMIndustry on Account (before insert, before update) { for(Account a1: Trigger.new){ if(a1.industry=='Government'){ a1.industry='Emergency Services'; } else if(a1.industry=='Agriculture'){ a1.industry='Agriculture & Fisheries'; } else if(a1.industry=='Apparel'){ a1.industry='Other'; } else if(a1.industry=='Banking'){ a1.industry='Finance'; } } }
- Katherine Rowe
- October 07, 2016
- Like
- 0
- Continue reading or reply
Flow to delete opportunity team members
Goal: When opportunity ownership is transfered and the "Keep Opportuntiy Teams" box is selected, then I want the flow to automatically delete the opportunity team member for the previous owner. Because we have Splits enabled, the owner is always added as an opporutnity team member. And as soon as the owner becomes the previous owner, I want the corresponding team member to be automatically deleted. For example, Joe owns the opp, Joe and Mary are team members. The opp is transfered to Bob, and the desired result should be that Bob and Mary are the only team members.
So far, I've got a single step in my flow that deletes the team member nicely. But it only works when "Keep Opportunity Teams" is selected. If I don't select "Keep Opportunity Teams", then the flow throws an error. Presumably because the team member has already been deleted and the flow doesn't know what to do? I'm not sure how to modify my flow to deal with this.
After I get that sorted out, then I need to make sure it can delete any splits it needs to.
- Katherine Rowe
- August 24, 2016
- Like
- 0
- Continue reading or reply
Need an example of an unhandled exception
I need a trigger that will throw an unhandled exception. I'm new to writing triggers, can someone help me whip one up? I'm testing the emails that SF sends out to the last modified user on the trigger, when there is an unhandled exception.
It can be really simple. I just want to be able easily fire the trigger in SF and for it to throw an unhandled exception.
- Katherine Rowe
- November 09, 2015
- Like
- 0
- Continue reading or reply
Unhandled exception sends email, can we stop that?
Disclaimer: Salesforce Admin here, not a developer.
The reason I don't want it to try and send an email is, we have Email Deliverability set to System Only in our test and dev environments. And sometimes when an action leads to a trigger failing, the error displayed is about the "NO_MASS_MAIL_PERMISSION" instead of the underlying cause. If I turn Email Deliverability to All Emails, then a more relevant error message then shows in its place, and we can then figure out the problem and deal with it. The triggers I'm referring to are in a managed package, so rewriting the trigger to perhaps handle exceptions better is not in our control. So for now, I want to see if we can simply stop SF from trying to email anyone at all...
When unhandled Apex exceptions occur, emails are sent that include the Apex stack trace and the customer’s org and user ID. No other customer data is returned with the report. Unhandled exception emails are sent by default to the developer specified in theLastModifiedBy field on the failing class or trigger.
What Happens When an Apex Exception Occurs?
https://help.salesforce.com/HTViewHelpDoc?id=code_apex_exceptions.htm
Error when Email Deliverability is set to System Only
Error when Email Deliverability is set to All Emails
- Katherine Rowe
- October 30, 2015
- Like
- 0
- Continue reading or reply
Eclipse error - Package Manifest Content Warning
Exception happened when resolving component type(s), so no component will be added to package manifest editor for these types.
*ExternalDataSource
See log for detail exception messages.
I'm not a developer, so I don't know much about eclipse. I'm using eclipse as a way to download the reports my users are using. So I can see what columns and criteria they're using. I just need to be able to pull this information from Salesforce, I won't be pushing any changes from Eclipse back to Salesforce.
- Katherine Rowe
- February 04, 2015
- Like
- 0
- Continue reading or reply
Locked out of my dev environment, how to unlock?
- Katherine Rowe
- January 15, 2015
- Like
- 0
- Continue reading or reply