Salesforce JavaScript button in Lightning - salesforce

We have some buttons on our contact page that via javascript update a handful of hidden fields on the object. We are moving to the lightning UI and I understand these are not supported, but am struggling to decipher the documentation on the best replacement. Can someone help point me in the right direction.
Requirement is to update several fields on the contact that is currently on the screen... nothing more, other than we don't use chatter so nothing with the feed please.

The Winter 17 release included the ability to create Actions based on Lightning Components. This is most likely the way you will want to go to convert your existing JavaScript buttons. I would suggest you check out this new Trailhead that was just released which is specifically about Lightning Alternatives to JavaScript buttons.
I am also working on a course for Pluralsight about Lightning development and this is one of the areas I plan on covering since it is so applicable to a lot of people right now. I am not sure if you realize this but by next year, any JavaScript buttons you have will no longer work (even in classic). It is part of a 3 phased approach that Salesforce is implementing to phase them out for security reasons.
Good luck in your conversion. I wish I could say it will be easy, but at least now it is possible.
Best.
Sara

Related

LWC and what it provides from a React developer's perspective

I'm a React developer for front-end stuff and I've recently been given the task of evaluating whether or not Lightning Out (LO) or Lightning Web Components (LWC) can be used in our React web app for communicating with Salesforce.
We have some users who will not be able to log directly into our Salesforce instance, and so the suggestion of using LO or LWC has been made as a possible alternative.
As a non-Salesforce developer, I have a question which I don't seem to be able to answer easily:
Do either of these offerings from Salesforce come with any extra functionality other than the look-and-feel? What I mean is, if I add something from LO or LWC to a React app, do they have inherent capabilities for communicating with Salesforce to fetch/update data or are they just "dumb" widgets that look like Salesforce-native widgets?
Are there any advantages to using LO or LWC over any other UI widget library when it comes to working with Salesforce?
Thanks
First of all, feels like you are using LO and LWC interchangeably, so I wanted to clear that up first:
LWC: Lighting web components are are custom HTML elements built using HTML and modern JavaScript that use core Web Components standards. I recommend checking out their playground if you want to test them first hand.
LO: Allows you to run LWC web components outside of Salesforce servers.
I am facing some of these questions myself, and I had to do a little bit of digging. I will attempt answer based on what I gathered after some research:
Do either of these offerings from Salesforce come with any extra functionality other than the look-and-feel?
The short answer is yes. The true question is whether what's provided is useful in your context or not. For example, they claim that it delivers exceptional performance (although I found solid posts putting that in question), in part thanks to its "Lightning Data Service" (centralized data caching framework which is used to load, save, create and delete a record without any server-side apex code). These are some other things that Salesforce claims are made easier thanks to LWC:
Find solutions in common places on the web.
Find developers with necessary skills and experience.
Use other developers' experiences (even on other platforms).
Develop faster.
Utilize full encapsulation so components are more versatile.
Are there any advantages to using LO or LWC over any other UI widget library when it comes to working with Salesforce?
When it comes to working directly with Salesforce you wouldn't need LO, and yes - there's a very clear advantage to having LWC components as you can easily mount/compose those on any Salesforce page to get desired functionality fairly fast. Particularly beneficial if the System of Record for the data behind the components is Salesforce and you don't currently have a front-end for that data.
I've seen examples for both using React within Lightning, and LWC (with LO) on a standalone SPA. Now to my 2c: both look atrocious from an app architecture standpoint. In addition to that, it's a pretty clear vendor lock-in, so if you don't have the immediate need or mandate to use LWC, just don't use them.
If there are any LWC & React experts out there that care to expand and/or correct any of these, by all means...

Add badge for android with codenameone

We tried more time to find badges with android using codename one, but I found some comments in stackoverflow is only working on IOS and not working on android, if true so when will it become available on android?.
Thanks in advance
When we created the badge code Android didn't support that UI paradigm. Arguably it still doesn't but some vendors include that functionality with a special API.
Currently the main thing holding this back is that no one asked for it or implemented it. First of all I suggest filing an RFE which will give you a way to track the schedule for adding this. You can add an RFE on http://github.com/codenameone/CodenameOne/issues/
You can also just implement this yourself and submit a pull request as explained in this post: https://www.codenameone.com/blog/how-to-use-the-codename-one-sources.html
This should be relatively easy although you will need to be careful with using the right API level options and might need to use reflection to avoid SDK dependencies which we don't want.
Other than that it's just a matter of interest if we need to implement it. If you have an enterprise account then make sure to let us know through the account of your interest in this feature. We also take pro account requests more seriously when assigning a feature.

Is it possible to use ExtJS components in AngularJS?

I'm really enjoying learning to use AngularJS. Now I'm looking for components I can use with it. I've been looking at Angular-UI components but I'd like to know if it's possible to use the nice, supercharged components in ExtJS. Does anyone have experience with this? Any hints or tips or Angular directive libraries?
The company I work for is making a similar move. We currently rely heavily on an older version (3.x) of ExtJS, and the effort to upgrade to the current (5.0) version is at least equal to the effort required to move to angular.
To answer the question (to the best of my limited knowledge):
They can exist together in the same JS application.
Can you use UI elements of ExtJs with Angular?
You can put angular in control of markup via HTML templates in Ext.
Is this a wise idea?
Probably not.
Why would I consider doing this?
I need absolute control over the markup and don't care about possible page load issues
I need to serialize or de-serialize in some special way that Ext doesn't innately provide
I need to do something special like pub/sub (still totally possible with Ext)
In our case, it is a proof of concept for a few modals. If I am biased, I am biased in the direction of ExtJs (which is a huge statement given my background). The more exposure I have to ExtJS, the more I personally like it. I've used several frameworks in the past like Ember, Backbone, KnockoutJs and AngularJs and they are excellent tools that are reaching a level of maturity that makes them excellent choices. That said, they don't follow the same development model/pattern that ExtJs does, and I don't think a direct compare is fair to either side.
It would be almost like comparing Ext to Node (silly, I know).
If your project requires some special functionality that you don't believe is possible in Ext, you are probably like me and have limited experience with it. If you have a lot of experience with Ext, and want to try what we are trying, I say go for it. The single downfall of Ext is the size of the built package that is delivered. Another small framework isn't going to help that, but it also isn't going to cause more pain.
In the end, for me, I just love JS and expanding my knowledge of how things work now and in the future.
For the post above asking about the lack of traction for Ext: the answer is simple... it's not free, and thus not an option for many of us who aren't writing commercial software that fits well with the license.
In our AngularJS app at work, we have integrated a 3rd party ExtJS app with it, not for its UI components though. We open certain popups of that app based on user input and when the user commits data in the popup, we respond to ExtJs events to refresh our app. AngularJS is flexible enough to integrate with any other Javascript code/libraries as long as the library has public events to respond to. I would recommend going through the Directive and scope documentation on how to effectively create directives and respond to scope events.
Personally I do not feel ExtJS and AngularJS would be needed together, unless you are forced to use it like me. There is http://angular-ui.github.io/ that brings in a lot to the table. Again any given JQuery plugin can be integrated using directives, filters etc in AngularJS. So you may want to investigate into that before trying to bother with ExtJS.
Why do you need AngularJS anyway if you have ExtJS? I agree learning Ext can be somewhat difficult though once you've bitten through it there is nothing better at the moment. The only disadvantage is the heavier footprint but who cares? It's not like it's causing any problems... We use nothing but ExtJS at work and the progress in our apps is amazing. It integrates seamlessly with Spring MVC. We don't need to hack in HTML directly which I consider more of an advantage than a disadvantage: no more writing tags, no more open/close tag issues, you can still use css and Ext handles any browser incompatibilities so what else do you need more?? Angular is just the new kid on the block but in total it can not (yet) compete with ExtJS. It doesn't even com close. Just my 2$.
Sencha is planning to add support in the framework. Please find the link at the bottom for reference:
At SenchaCon in Las Vegas on November 7-9 2016, Sencha will be introducing the ability to use Ext JS components, layouts, and themes within an Angular 2 application, which we are currently calling the Ext JS Bridge to Angular 2 (also known as ‘The Bridge’).
https://www.sencha.com/blog/first-look-ext-js-bridge-to-angular-2/

WordPress 3.5 Media Manager: Is there a "good" way to add an additional select option within Create Gallery tab?

By good, I mean using hooks/filters.
Basically, by default the two options are Images and Uploaded to this page. I would like to add an additional option in there. I know how to add a new tab to the media manager (see here), but that doesn't achieve what I need.
I've been looking through the limited documentation on 3.5 and have found the media_view_strings/settings filters, but, based on what I can tell, neither could be used in this case. I've also done quite a bit of digging through the core source, but the number of files relating to the media uploader is daunting to say the least.
I thought about running JS after page load to modify the DOM and just add the extra select option in, but this seems very hackish and I'd like to avoid it if there is a better, more robust solution.
Any thoughts on the best way to approach this would be greatly appreciated!
Note: I didn't post this to the WordPress SE Site since it gets much less traffic and the questions tend to be much less programming-related.
Most of those select-dropdowns are from wp-includes/media-template.php, which has a lot of Underscore templating (<script type="text/html" tags), but few action hooks for php code. With Javascript you can bind the Backbone.js hooks for wp.media events, such as wp.media's open/close events. From such event you could grab that Images/uploaded-to-page selectbox with jQuery('.media-modal-content:visible .attachment-filters'), add item(s) and listeners as needed. I'm pretty sure there should be a much better Backbone.js-style solution, though.
Here is a tutorial by Shiba Shake on this subject ...
How to Expand the WordPress Media Manager Interface
Hope this is helpful to you!

display a calendar function on lots of different websites

first of all, please excuse my ignorance, this is an exploratory question, rather than a specific programming program that needs solving.
I have a number of clients that have unique websites, none of which I was involved in developing. I would like them to be able to display a calendar of common events, but which would also contain events unique to them.
Is it possible using something like Server Side Includes to be able to give them a few lines of code which they could insert into their website (on any particular page) which might display a calendar type display, which their users can then interact with?
I guess I am looking for something similar to a Google calendar but I do not want to use a Google calendar. The key thing would be that they would only need to insert the few lines of code on one of their webpages; they wouldn't have to install any software on their servers.
Any suggestions?
Thanks
Damien
There are are all sorts of web calendars that will allow you to include them on a web page (typically using javascript, not SSI). Some are targeted at specific platforms (ie, Wordpress) and some are more generic.
Try searching "web calendar widget" for examples.
You'd have to put some amount of content on their site. If you can do that, you can include some javascript that will load more javascript from the server side that can do the bulk of the calendaring work for you.
You wouldn't be able to just drop a few files on the server and have them work, you'd need some way to link to them by changing the existing content on at least one of the pages.
I may be misunderstanding your question though.
If you are looking for specific recommendations on web calendar widgets, Arshaw's fullcalendar is my favorite to date.
It displays a great calendar that can be easily styled with css or jquery ui themeroller and is very programmable. The website has great documentation and examples as well.
Per using it on different sites, it supports that easily.
Note, I'm not affiliated with that calendar at all, just a satisfied customer.

Resources