Last week, at Snowforce in Salt Lake City, I saw a demonstration of the Lightning App Builder and decided that I wanted to make a Lightning component of my own. I thought the best thing to do was to follow the quick-start PDF, and was quite proud of that. I made the text say “Hello David!” which seemed like a good start. Mike Gerholdt then challenged me to render the word “David” dynamically, pulling from the running user. I checked the documentation, and there is no $User global variable as there is in Visualforce, so I was faced with a conundrum: How to pull fields from the current User record? The documentation and quick-start expenses app show how to pull a list of records and then to choose one from those, but I wanted something different. After perusing Reid Carlberg’s post about Lightning components, I had my answer. I won’t […]
In the previous post, we looked at using the standard (button-click) way to create a new child record using Publisher Actions. Pretty basic stuff. Using Visualforce to create a custom action is a bit harder. Let's start with the documentation. The PDF provided by clicking on the link in the Actions screen (Account action is an example) has nothing about Visualforce. Searching in the Help & Training section yields a page Creating Visualforce Pages to Use as Custom Publisher Actions, but I can't see where that page is found in the help tree on the left side of the page. Interestingly, to find correct code (because the item above has a misprint) I had to go to Customizing Case Feed with Visualforce (PDF). Let's set up our use-case and see what we can do with a Visualforce publisher. As before, we want to create a Task from a Case. The […]
Workflow is great. I can simply and declaratively make changes, and can easily update things like email templates, criteria, tasks, etc. without using Eclipse and writing/running unit tests. Sometimes, however, workflow isn’t enough; we need to use a trigger. Today, I had a use-case that when a DateTime field is filled, a contact (identified via a lookup on a parent object – so a grandparent record) should receive a notification. That’s easy enough to do with a ISCHANGED(DateTimeField__c) workflow criteron, but the Email Alert can’t “find” the contact. A trigger is necessary. Here’s how I coded the trigger: I’ve left out a lot of parts here, but I hope that the main bit of using Trigger.oldMap to find the old value and compare it to the new one comes through. Happy coding!