Please guide me how to call a method in LWC - salesforce

I have a static method in a class from which I am getting a string which is in the form of link. Now when I am trying to pull the same data in the LWC, I am getting the data as undefined.
Can anyone please explain me if I need to perform any conversion in the logic or I have to add extra logic in JS.

Your Apex method should be annotated with #AuraEnabled(cacheable=true) to be used with LWC.
Then you can simply import your method in LWC using either #wire or imperative Apex.
Checkout the standard documentation here
Please add your code here if you're still having issues.

If you are using Apex, your static method must have #AuraEnabled(cacheable=true) if you wan't to be able to store the data in lwc.

Related

Using AvatarAPI with ReactJS

I have a use case where I need to use Avatar API(https://avatarapi.com/) that fetches user profile based on the email address. I tried adding a script to useEffect hook to render the data but it does not show anything.
I am using the Javascript API from https://avatarapi.com/
Following is the link of my implementation: https://stackblitz.com/edit/react-yxfcpw
I have tried to implement it using fetch and extracting the image url using Regex and rendering the image accordingly.
My implementation mentioned above worked but now it complains You can only call this free script 100 times, perhaps you should see our API on www.avatarapi.com?
Any help would be appreciated.
Note: I cannot use the XML API.
You can use XML API method of AvatarApi website

how can access to the cell edited in tabulator with react

I'm using react tabulator, displaying the data works perfectly, but I need to allow that the user can add tags in some cells, it's not clear to me how to achieve this because the docs only have concise information about this and using the standard (vanilla js) library, I can't find a reacts way to achieve this
I'd like to connect the event with a redux dispatcher because I need to run an action when the user add or delete tags, but not sure if it's possible with this lib
I'd appreciate any help, guide, or clue about how can I achieve this, thank you so much
Use react-tabulator instead of tabulator

can we create a pick list in lead page layout getting data from external api

I am trying to call an external api from salesforce apex class which will get all the products.so next i want to show these products as picklist in salesforce lead creation or edit page.I am not sure its possible or not.Any solution or workaround on these is mostly appreciated.
I don't see a way to do this on a standard layout.
I personnaly could do this in a Visualforce page. Probably you probably can do this in a Lightning page as well.

CakeEmail reformat before sending

Does anyone know if it is possible to override the message content in CakePHP CakeEmail version 2.9.1?
I'm using a template to format my e-mail which is working great, but just before I send the e-mail I want to encrypt it using GNUPG. The idea was to get the fully rendered message, parse it through my encryption function and then send it, is this possible?
Plan B would be to do everything from the AppShell but I wanted to uterlise the Html helper, is it possible to load this as a Helper in the AppShell.
I'm limited to running inside a plugin as the main application is controlled from a third party.
Thanks in advance.
You can create a custom view class that does it (https://book.cakephp.org/2.0/en/views.html#creating-your-own-view-classes) and pass it to CakeEmail object via viewRender method.

AngularJS page validation

I am developing an AngularJS/Web Api application, is there any way that we can write any Page validations in C# code and can be called from AngularJS as a service call?
i.e. the C# code is converted to JSON object where the angularJS service read the JSON object to enable/disable other controls? With this approach i can keep all my validation logic in one centralised place.
I don't want to write the same validation logic in the Angular script.
Please suggest.
Thanks
If I understand you correctly, you want to have only server-side validation. And at the same time you want your validation to happen asynchronously at server. And for end-user it would seem like a client-side validation.
Whether you are using Web API or Spring java, it is possible. There is a framework that can greatly simplify it. Just download example and see how it works:
https://upida4net.codeplex.com
By the way, you can take a look at working example here: http://upida.cloudapp.net:8080/org.upida.example.angular/
I promise, you will be surprised with amount of code there.

Resources